All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jn.langx.util.collection.stack.Stack Maven / Gradle / Ivy

Go to download

Java lang extensions for java6+, a supplement to , replacement of a Guava, commons-lang. Core utilities, Collection utilities, IO utilities, Cache, Configuration library ...

There is a newer version: 4.8.2
Show newest version
package com.jn.langx.util.collection.stack;

import java.util.Collection;
import java.util.EmptyStackException;

public interface Stack extends Collection {
    /**
     * Pushes an item onto the top of this stack. This has exactly
     * the same effect as:
     * 
     * addElement(item)
* * @param item the item to be pushed onto this stack. * @return the item argument. * @see java.util.Vector#addElement */ public E push(E item); /** * Removes the object at the top of this stack and returns that * object as the value of this function. * * @return The object at the top of this stack (the last item * of the Vector object). * @throws EmptyStackException if this stack is empty. */ public E pop() ; /** * Looks at the object at the top of this stack without removing it * from the stack. * * @return the object at the top of this stack (the last item * of the Vector object). * @throws EmptyStackException if this stack is empty. */ public E peek() ; /** * Returns the 1-based position where an object is on this stack. * If the object o occurs as an item in this stack, this * method returns the distance from the top of the stack of the * occurrence nearest the top of the stack; the topmost item on the * stack is considered to be at distance 1. The equals * method is used to compare o to the * items in this stack. * * @param o the desired object. * @return the 1-based position from the top of the stack where * the object is located; the return value -1 * indicates that the object is not on the stack. */ public int search(Object o); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy