ArrayList In Java

List Interface:

1. Can contain duplicates and elements are ordered.
2. List interface is implemented by the classes ArrayList, LinkedList, Vector, and Stack.
3. Lists represents an ordered collection of elements. Using lists, we can access elements by their integer index (position in the list), and search for elements in the list. index start with 0, just like an array.

ArrayList Class in Java:

Properties: 
Ordered – Elements in arraylist preserve their ordering which is by default the order in which they were added to the list.
Index based – Elements can be randomly accessed using index positions. Index start with '0'.
Dynamic resizing:
Non synchronized:
Duplicates allowed – We can add duplicate elements in arraylist. It is not possible in sets.
How to create:
ArrayList<String> alist=new ArrayList<String>();

Methods: add(), set(int index, Object o), remove(index or value), get(int index), indexOf(Object o), int size(), boolean contains(Object o), clear() etc.

To get more details please watch below youtube video and Subscribe the channel.

Part1:


Part2:




No comments:

Post a Comment