ArrayDeque class Methods in Java Part -II

java.util.ArrayDeque<E>

Resizable-array implementation of the Deque

interface. Array deques have no capacity restrictions; they grow as necessary to support usage. 

Some methods of ArrayDeque.


ArrayDeque.peek()This method retrieves but does not remove, the head of the queue represented by this deque, or returns null if this deque is empty.


ArrayDeque.peekFirst()This method retrieves but does not remove, the first element of this deque, or returns null if this deque is empty.


ArrayDeque.peekLast()This method retrieves but does not remove, the last element of this deque, or returns null if this deque is empty.


ArrayDeque.poll()This method retrieves and removes the head of the queue represented by this deque.


ArrayDeque.pollFirst()This method retrieves and removes the first element of this deque, or returns null if this deque is empty.


ArrayDeque.pollLast()This method retrieves and removes the last element of this deque, or returns null if this deque is empty.


ArrayDeque.pop()This method pops an element from the stack represented by this deque.


ArrayDeque.push(E)This method pushes an element onto the stack represented by this deque.


ArrayDeque.remove()This method retrieves and removes the head of the queue represented by this deque.


ArrayDeque.remove(Object)This method removes a single instance of the specified element from this deque.


ArrayDeque.removeAll(Collection)This method removes all of this collection's elements that are also contained in the specified collection.


ArrayDeque.removeFirst()This method retrieves and removes the first element of this deque.


ArrayDeque.removeFirstOccurrence(Object)This method removes the first occurrence of the specified element in this deque.


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


ArrayDeque.removeLast()This method retrieves and removes the last element of this deque.


ArrayDeque.removeLastOccurrence(Object)This method removes the last occurrence of the specified element in this deque.


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


ArrayDeque.size()This method returns the number of elements in this deque.


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


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


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


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


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


Some more Methods of ArrayDeque class


No comments:

Post a Comment