There are only two main types of Java container classes: collection and map.
Collection containers have only one element per slot.
The map holds the key-value pairs associated.
The collection sub-interface has list and set.
List: Stores elements in a specific order. Like ArrayList and LinkedList.
ArrayList: Good at random access.
LinkedList: Good at inserting, deleting, and moving elements.
Vector: Synchronization, security, low performance. The rest is as basic as ArrayList.
Set: Does not contain duplicate elements.
HashSet: Use hash function.
TreeSet: Use red and black trees. Orderly data arrangement
Linkedhashset: Use linked lists with hash functions.
Map subclasses have HashMap, Hashtable, and TreeMap
HASHMAP: Allows a null key and multiple null values.
HashTable: null keys and null values are not allowed. Thread Safety
Container class Output modes: Iterator, Listiterator, enumeration, and foreach
Iterator:
list<string> all = new arraylist<string> (); All.add ("Hello"); Iterator<string> iter = All.iterator (); while (Iter.hasnext ()) {System.out.print (Iter.next ()); }
Foreach:
list<string> all = new arraylist<string> (); All.add ("Hello"); for (String str:all) System.out.print (str);
Java Container Class Summary