1. ArrayList
2. LinkedList
List VS. Set
List:
-Allowing duplicate elements
-List is an ordering collection
Set:
-Doesn't allow any duplication
-Set in java doesn't maintain any order.
ArrayList Class
-Uses dynamic array for storing - algorithm
-Can contain duplicate
-not syncronized (It is not Thread safe, So It is lower performance)
-Maintain order
-Random access
-Manipulation slow because a lot of shifting needs to be occurred.
ArrayList has mainly two methods
-add() - Add the elements on ArrayList
-get() - get the elements from the ArrayList
LinkedList
LinkedList has two type
- Single Linked List
- Doubly Linked List (java has doubly linkesList)
LinkedList Class
-Uses doubly linked list to store the elements
-Can contain duplicate elements
-not syncronized (It is not Thread safe)
-Maintains insertion order
-No Random access
-Manipulation fast because no shifting needs to be occurred.
No comments:
Post a Comment