Question: What are the methods of Java Stack?

Answer: SN:1
Method: add()  
Description: It is used to append the specified element in the given vector.

SN:2
Method: addAll()  
Description:It is used to append all of the elements in the specified collection to the end of this Vector.

SN:3
Method:addElement()   
Description:It is used to append the specified component to the end of this vector. It increases the vector size by one.

SN:4
Method:  capacity() 
Description:It is used to get the current capacity of this vector.

SN:5
Method:   clear()
Description:It is used to delete all of the elements from this vector.

SN:6
Method:   clone()
Description:It returns a clone of this vector.

SN:7
Method:   contains()
Description:It returns true if the vector contains the specified element.

SN:8
Method:   containsAll()
Description:It returns true if the vector contains all of the elements in the specified collection.

SN:9
Method:   copyInto()
Description:It is used to copy the components of the vector into the specified array.

SN:10
Method:   elementAt()
Description:It is used to get the component at the specified index.

SN:11
Method:    elements()
Description: It returns an enumeration of the components of a vector.

SN:12
Method:   ensureCapacity()
Description:It is used to increase the capacity of the vector which is in use, if necessary. It ensures that the vector can hold at least the number of components specified by the minimum capacity argument.

SN:13
Method:   equals()
Description:It is used to compare the specified object with the vector for equality.

SN:14
Method:   firstElement()
Description:It is used to get the first component of the vector.

SN:15
Method:   forEach()
Description:It is used to perform the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

SN:16
Method:   get()
Description:It is used to get an element at the specified position in the vector.

SN:17
Method:   hashCode()
Description:It is used to get the hash code value of a vector

SN:18
Method:   indexOf()
Description:It is used to get the index of the first occurrence of the specified element in the vector. It returns -1 if the vector does not contain the element.

SN:19
Method:   insertElementAt()
Description:It is used to insert the specified object as a component in the given vector at the specified index.

SN:20
Method: isEmpty()  
Description:It is used to check if this vector has no components.

SN:21
Method:   iterator()
Description: It is used to get an iterator over the elements in the list in proper sequence.

SN:22
Method:lastElement()   
Description:It is used to get the last component of the vector.

SN:23
Method: lastIndexOf()  
Description: It is used to get the index of the last occurrence of the specified element in the vector. It returns -1 if the vector does not contain the element.

SN:24
Method: listIterator()  
Description:It is used to get a list iterator over the elements in the list in proper sequence.

SN:25
Method:   remove()
Description:It is used to remove the specified element from the vector. If the vector does not contain the element, it is unchanged.

SN:26
Method:   removeAll()
Description: It is used to delete all the elements from the vector that are present in the specified collection.

SN:27
Method:  removeAllElements() 
Description:It is used to remove all elements from the vector and set the size of the vector to zero.

SN:28
Method:   removeElement()
Description:It is used to remove the first (lowest-indexed) occurrence of the argument from the vector.

SN:29
Method:   removeElementAt()
Description:It is used to delete the component at the specified index.

SN:30
Method:   removeIf()
Description:It is used to remove all of the elements of the collection that satisfy the given predicate.

SN:31
Method:   removeRange()
Description:It is used to delete all of the elements from the vector whose index is between fromIndex, inclusive and toIndex, exclusive.


SN:32
Method:   replaceAll()
Description:It is used to replace each element of the list with the result of applying the operator to that element.

SN:33
Method:   retainAll()
Description:It is used to retain only that element in the vector which is contained in the specified collection.

SN:34
Method:   set()
Description:It is used to replace the element at the specified position in the vector with the specified element.

SN:35
Method:   setElementAt()
Description:It is used to set the component at the specified index of the vector to the specified object.

SN:36
Method:   setSize()
Description:It is used to set the size of the given vector.


SN:37
Method:   size()
Description:It is used to get the number of components in the given vector.

SN:38
Method: sort()  
Description:It is used to sort the list according to the order induced by the specified Comparator.

SN:39
Method:   spliterator()
Description:It is used to create a late-binding and fail-fast Spliterator over the elements in the list.

SN:40
Method:   subList()
Description:It is used to get a view of the portion of the list between fromIndex, inclusive, and toIndex, exclusive.

SN:41
Method:  toArray() 
Description:It is used to get an array containing all of the elements in this vector in correct order.

SN:42
Method:   toString()
Description:It is used to get a string representation of the vector.

SN:43
Method:   trimToSize()
Description:It is used to trim the capacity of the vector to the vector's current size.