Java Collections Framework PDF
Java Collections Framework PDF
Collection Map
Sorted-
Set List Queue
Map
Sorted- Navigable-
Deque
Set Map
Navigable-
Set
Collection Map
Sorted-
Set List Queue
Map
Sorted- Navigable-
Note: Deque
Map does not
Set Map
extend Collection;
Navigable-
but it is a “collection”.
Set
Collection Map
Sorted-
Set List Queue
Map
Collection Map
Sorted-
Set List Queue
Map
Sorted- Navigable-
Deque
Set Map
Navigable-
Set
s = <10, 7, 4, –2>
s.subList(1,3).clear();
s = <10, –2>
Code State
m = {("PB", 99),
("BK", 42),
("SA", 42)}
m.values().remove(42);
m = {("PB", 99),
("SA", 42)}
m.values().remove(42);
m = {("PB", 99),
("SA", 42)}
Collection Object
Abstract-
Collection
Collection Object
Abstract-
Set
Collection
AbstractSet
HashSet TreeSet
Collection Object
Abstract-
List
Collection
AbstractList
ArrayList LinkedList
Map Object
AbstractMap
HashMap TreeMap
Throws:
• be “ordered” or “unordered”
UnsupportedOperationException - if the add operation is not supported by this set
ClassCastException - if the class of the specified element prevents it from being added to this set
• “have duplicates” or “not have duplicates”
NullPointerException - if the specified element is null and this set does not permit null elements
IllegalArgumentException - if some property of the specified element prevents it from being added to this
set