- ArrayList
- LinkedList
- Resizable
- Allow retrieving elements by their index
- Orderd collection
- Allows Duplicate and null values
- Dose not support inserting data in the middle of the list
- Dose not support primitive types
- Almost like ArrayList
- Internally way of storing data is different
- It store an object called "nodes" which connect each other and form a chain
- Allow inserting data in the middle of the list
- Uses more overall memory than a ArrayList
- Slower when looking up a value in a random index
List Example: ArrayList vs LinkedList
The idea of different way of implementing same operation is called ADT.
- Stack
- Queue
- Last In First Out (LIFO)
- push : Add an element to the TOP
- pop : Remove the TOP element
- peek : Examine the TOP element (Dose not remove it)
- Dose not allow to see how many elements in a stack
- First In First Out (FIFO)
- add : Add an element to the BACK of the queue(AKA: enqueue)
- remove : Remove an element from the FRONT of the queue (AKA: dequeue)
- peek : Examine the FRONT element (Dose not remove it)
- Dose not allow to see how many elements in a queue
ADT Example: Stack vs Queue
A Collection of unique values. We dont think of a set as having any indexes. We just add things to the set in general.
- No duplicate value allowed
- Perform Add, Remove, Search(Contain) operations
Set Example: Set
A Collection that stores pairs, where each pair consists of first half called "Key" and second half called "Value"
- Sometimes called "dictionary/ associative array/ hash"
- Basic operations put, get, remove
Map Example: Map
Reading a Long Text file word by word List took pretty long time than Set or Map, wheather Set and Map took almost same time. Note: every word is unique word. The program tested on Intel Core i3 processor with 3.30 GHz in 12 Gigs of Ram.
Stanford(CS-106B) : http://stanford.edu/class/archive/cs/cs106b/cs106b.1184/index.shtml