53. Mapping Map

Map is like an object. The key of an object can only be a string, and the key of a Map can be any type of value (including complex types such as objects and arrays).

Table of contents

1 Create a map

2 common instance methods

2.1 Add mapping set()

2.2 Get the mapping value get()

2.3 Delete mapping delete()

2.4 Determine whether there is a mapping has()

2.5 Clear all mappings clear()

2.6 Return key traverser keys()

2.7 The iterator values() of return value

2.8 Return key and value traverser entries()

2.9 Traverse map forEach()


1 Create a map

2 common instance methods

2.1 Add mapping set()

2.2 Get the mapping value get()

The parameter writes the name of the key.

2.3 Delete mapping delete()

The parameter writes the name of the key.

2.4 Determine whether there is a mapping has()

It is enough to write the name of the key as a parameter, if there is, it will return true, if not, it will return false

2.5 Clear all mappings clear()

2.6 Return key traverser keys()

2.7 The iterator values() of return value

2.8 Return key and value traverser entries()

2.9 Traverse map forEach()

The first parameter is the value and the second parameter is the key

Guess you like

Origin blog.csdn.net/potato123232/article/details/131919707