Stack

Download

Download jar file or use maven. psjava requires Java 1.6 (or above)

<dependency>
    <groupId>org.psjava</groupId>
    <artifactId>psjava</artifactId>
    <version>0.1.19</version>
</dependency>

Example Code

StackFactory factory = GoodStackFactory.getInstance();

Stack<String> stack = factory.create();
stack.push("A");
stack.push("B");
stack.push("C");

// Operations

boolean empty = stack.isEmpty(); // must be false
String top = stack.top(); // must be "C"
String pop1 = stack.pop(); // must be "C"
String pop2 = stack.pop(); // must be "B"

Implementation


Copyright 2014 psjava team. View on GitHub