hostpaster.blogg.se

Java stack
Java stack






java stack

elementAt(int index) Returns the component at the specified index. copyInto(Object array) Copies the components of this vector into the specified array.

java stack

containsAll(Collection c) Returns true if this Vector contains all the elements in the specified Collection. contains(Object o) Returns true if this vector contains the specified element. clear() Removes all the elements from this Vector. capacity() Returns the current capacity of this vector. addElement(Object o) Adds the specified component to the end of this vector, increasing its size by one. addAll(int index, Collection c) Inserts all the elements in the specified Collection into this Vector at the specified position. In the order that they are returned by the specified Collection’s Iterator. addAll(Collection c)Īppends all of the elements in the specified Collection to the end of this Vector, add(int index, Object obj) Inserts the specified element at the specified position in this Vector. Methods inherited from class ĭESCRIPTION add(Object obj) Appends the specified element to the end of this Vector. It returns the position of the element from the top of the stack. It determines whether an object exists in the stack. Pushes an element on the top of the stack. An ‘EmptyStackException’Īn exception is thrown if we call pop() when the invoking stack is empty. Removes and returns the top element of the stack. Returns the element on the top of the stack, but does not remove it. It returns true if nothing is on the top of the stack. Stack after pop operation Methods in Stack Class The below example creates an empty Stack. In order to create a stack, we must import package and use the Stack() constructor of this class. RandomAccess: This is a marker interface used by List implementations to indicate that they support fast (generally constant time) random access.List:The List interface provides a way to store the ordered collection.The Collection interface is used to pass around collections of objects where maximum generality is desired. Collection: A Collection represents a group of objects known as its elements.Iterable: This interface represents a collection of objects which is iterable - meaning which can be iterated.Cloneable: This is an interface in Java which needs to be implemented by a class to allow its objects to be cloned.Serializable: It is a marker interface that classes must implement if they are to be serialized and deserialized.ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.








Java stack