List : An Ordered Collection (called a sequence). Lists can contain duplicate elements.
- We have precise control over on List, where in the List each element is inserted and can access elements by their integer index (position).
There are 3 flavours of List implementation Classes :
1. Array List
2. Linked List
3. Vector
- We have precise control over on List, where in the List each element is inserted and can access elements by their integer index (position).
There are 3 flavours of List implementation Classes :
1. Array List
2. Linked List
3. Vector
- In addition to the operations inherited from Collection, the List interface includes operations for the following:
- Positional access : manipulates elements based on their numerical position in the List
- Search : searches for a specified object in the list and returns its numerical position
- Iteration : extends Iterator semantics to take advantage of the List's sequential nature
- Range-view : performs arbitrary range operations on the List.
ArrayList:
- Positional access : manipulates elements based on their numerical position in the List
- Search : searches for a specified object in the list and returns its numerical position
- Iteration : extends Iterator semantics to take advantage of the List's sequential nature
- Range-view : performs arbitrary range operations on the List.
ArrayList:
ArrayList is a Collection which can be used to represent a group of objects as a single entity.
- it is a implemented class for List interface
- Introduced in 1.2 version
- The underlying data structure is resizable or growable array.
- Insertion order is preserved
- Duplicates are allowed
- Heterogeneous objects are allowed
- null insertion is possible
- This class implements RandomAccess , Serializable , Cloneable interfaces
- Best choice for retrieval purpose and worst if our frequent operation is insertion or deletion in the middle
Linked List:
LinkedList is a Collection implemented class which can be used for representing a group of objects as a single entity.
- LinkedList is the implemetation class for List interface
- Introduced in 1.2 version
- Underlying data Structure is DoubleLinkedList
- Allows duplicates
- Insertion order is preserved
- Allows heterogeneous objects
- null insertion is possible
- LinkedList class implements Seriallizable and Cloneable interface but not RandomAccess interface
- Best choice if frequent operation is insertion or deletion an objects in middle but worst choice if frequent operation is retrieval.
Vector class:
Vector is a legacy collection class which can be used to represent a group of objects.- Introduced in 1.0 version. it is legacy class
- The underlying data structure is resizable or growable array.
- Insertion order is preserved
- Duplicates are allowed
- Heterogeneous objects are allowed
- It is a implemented class for List interface
- null insertion is possible
- Vector class implements RandomAccess ,Serializable,Cloneable interfaces
- Best Choice if frequent operation is retrieval and worst choice if frequent operation is insertion or deletion in the middle.
- All methods present in Vector class are synchronized hence Vector class object is thread safe.
No comments:
Post a Comment