ArrayList class Methods in Java Part -I

java.util.ArrayList

Resizable-array implementation of the List interface.

Some of the Methods of ArrayList

ArrayList.add(E)This method appends the specified element to the end of this list.


ArrayList.addAll()This method appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.


ArrayList.addAll() index: This method inserts all of the elements in the specified collection into this list, starting at the specified position.


ArrayList.add(int, E)This method inserts the specified element at the specified position in this list.


ArrayList.clear()The list will be empty after this call returns.


ArrayList.clone()This method returns a shallow copy of this ArrayList instance.


ArrayList.contains(Object)This method returns true if this list contains the specified element.


AbstractCollection.containsAll()This method returns true if this collection contains all of the elements in the specified collection.


ArrayList.ensureCapacity(int)This method increases the capacity of this ArrayList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.


ArrayList.equals(Object)This method compares the specified object with this list for equality.



ArrayList.forEach(Consumer)This method performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.


ArrayList.get(int) This method returns the element at the specified position in this list.



ArrayList.hashCode(): This method returns the hash code value for this list.


ArrayList.indexOf(Object)This method returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.


ArrayList.isEmpty()This method returns true if this list contains no elements.



ArrayList.iterator()This method returns an iterator over the elements in this list in proper sequence.





No comments:

Post a Comment