Skip to content

Tag Archives: Java-Stack

The capacity() method of Stack Class is used to get the capacity of this Stack. That is the number of elements present in this stack… Read More
The retainAll() method of java.util.Stack class is used to retain from this stack all of its elements that are contained in the specified collection. Syntax:… Read More
The Java.util.Stack.hashCode() method in Java is used to get the hashcode value of this Stack. Syntax: Stack.hashCode() Parameters: The method does not take any parameter.… Read More
The Java.util.Stack.removeAll(Collection col) method is used to remove all the elements from the Stack, present in the collection specified. Syntax: Stack.removeAll(Collection col) Parameters: This method… Read More
The Java.util.Stack.lastIndexOf(Object element) method is used to check and find the occurrence of a particular element in the Stack. If the element is present in… Read More
The Java.util.Stack.elements() method of Stack class in Java is used to get the enumeration of the values present in the Stack. Syntax: Enumeration enu =… Read More
The Java.util.Stack.firstElement() method in Java is used to retrieve or fetch the first element of the Stack. It returns the element present at the 0th… Read More
The Java.util.Stack.lastElement() method in Java is used to retrieve or fetch the last element of the Stack. It returns the element present at the last… Read More
The ensureCapacity() method of Java.util.Stack class increases the capacity of this Stack instance, if necessary, to ensure that it can hold at least the number… Read More
The clone() method of Stack class is used to return a shallow copy of this Stack. It just creates a copy of the Stack. The… Read More
The Java.util.Stack.iterator() method is used to return an iterator of the same elements as that of the Stack. The elements are returned in random order… Read More
The java.util.Stack.copyInto() method is used to copy all of the components from this Stack to another Stack, having enough space to hold all of the… Read More
The Java.util.Stack.elementAt(int pos) method is used to fetch or retrieve an element at a specific index from a Stack. Syntax: Stack.elementAt(int pos) Parameters: This method… Read More
The Java.util.Stack.isEmpty() method in Java is used to check and verify if a Stack is empty or not. It returns True if the Stack is… Read More
The Java.util.Stack.insertElementAt(element, index) method is used to insert a particular element at the specified index of the Stack. Both the element and the position is… Read More