Please enable JavaScript.
Coggle requires JavaScript to display documents.
Collections Interface, Map - Coggle Diagram
Collections Interface
Query operations
int
size
()
boolean
isEmpty
()
boolean
contains
(Object o)
T[]
toArray
(T[] a)
Iterator<E>
iterator
()
Object[]
toArray
()
Bulk Operations
boolean
containsAll
(Collection<?> c)
boolean
addAll
(Collection <?> c)
boolean
removeAll
(Collection <?> c)
Java 8+
boolean
removeIf
(Predicate< ?> filter)
Stream<E>
stream
()
Stream<E>
parallelStream
()
boolean
retainAll
(Collection<?> c)
void
clear
()
Modification operations
boolean
add
(E e)
boolean
remove
(Object o)
Map
Methods
void
clear
(), boolean
isEmpty
(), int
size
()
V
get(
Object key)
V
put
(K key, V value)
V
remove
(Object key)
boolean
containsKey
(Object key)
boolean
containsValue
(Object val)
Set<K>
keySet
()
Collection<V>
values
()
HashMap
Store keys in a
Hash Table
Setting and retrieving elements takes on average
O(1)
The original order of elements is lost.
Allow both
null values
and
null keys
TreeMap
Implemented using a
Tree
Stores the
keys
in
sorted order
Adding and checking if a key exists takes
O(log n)
LinkedHashMap
Implemented by using a
doubly linked list
It preserves the insertion order of elements