2019-05-27 Java learning diaries Map collection & simulation Landlords shuffling cards

Map collection

Overview and Features Map collection:

A: Overview

The key value mapped to the object

A map can not contain duplicate keys

Each key can map up to a value

B: Map of different interfaces and interface Collection

Map is a two-column, Collection is a single row

Unique, Collection sub-system Set Map is unique

Map data structure value for a set of valid keys, nothing to do with value; data structures Collection is a set of elements for effective

Map collection features overview:

a: add functionality

  V put (K key, V value): additive element

    If the key is first stored, the direct memory element, return null

    If the key is not the first store to replace the previous value with the value and returns the previous value

b: delete function

void clear (): Removes all of the elements key

V remove (Object key): The key to delete the key element, and returns the value

c: determining function

boolean containsKey (Object key): determining whether the collection contains a specified key

boolean containsValue (Object value): determining whether the collection contains a specified value

boolean isEmpty (): determines whether the set is empty

d: acquisition function

Set<Map.Entry<K,V>> entrySet():

V get (Object key): Gets the value according to the key

Set <K> keySet (): Get the set of all keys in the set

Collection <V> values ​​(): Gets a collection of all the worthy collection

e: length Function

int size (): returns the set number of key-value pairs

 

Guess you like

Origin www.cnblogs.com/clqbolg/p/10934911.html