ArrayList class Methods in Java Part - II

java.util.ArrayList

Resizable-array implementation of the List interface.

Some of the Methods of ArrayList

ArrayList.listIterator(int)This method returns a list iterator over the elements in this list starting at the specified position in the list.


Collection.parallelStream()This method returns a possibly parallel Stream with this collection as its source.


ArrayList.remove(int)This method removes the element at the specified position in this list.


ArrayList.removeAll(Collection)This method removes from this list all of the elements that are contained in the specified collection.


ArrayList.removeIf(Predicate)This method removes all of the elements of this collection that satisfy the given predicate.


ArrayList.remove(Object)This method removes the first occurrence of the specified element from this list if it is present.


ArrayList.replaceAll(UnaryOperator)This method replaces each element of this list with the result of applying the operator to that element.


ArrayList.retainAll(Collection)This method retains only the elements in this list that are contained in the specified collection.


ArrayList.set(int, E)This method replaces the element at the specified position in this list with the specified element.


ArrayList.size()This method returns the number of elements in this list.



ArrayList.sort(Comparator)This method sorts this list according to the order induced by the specified Comparator. 


ArrayList.spliterator()This method creates a late-binding and fail-fast Spliterator over the elements in this list.


Collection.stream()This method returns a sequential Stream with this collection as its source.


ArrayList.subList(int, int)This method returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.



ArrayList.toArray()This method returns an array containing all of the elements in this list in proper sequence.


ArrayList.toArray(E[])This method returns an array containing all of the elements in this list in proper sequence.


AbstractCollection.toString()This method returns a string representation of this collection.


ArrayList.trimToSize()This method trims the capacity of this ArrayList instance to be the list's current size.






No comments:

Post a Comment