mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
fun with collections
This commit is contained in:
20
classpath/java/util/Stack.java
Normal file
20
classpath/java/util/Stack.java
Normal file
@ -0,0 +1,20 @@
|
||||
package java.util;
|
||||
|
||||
public class Stack<T> extends Vector<T> {
|
||||
public boolean empty() {
|
||||
return size() != 0;
|
||||
}
|
||||
|
||||
public T peek() {
|
||||
return get(size() - 1);
|
||||
}
|
||||
|
||||
public T pop() {
|
||||
return remove(size() - 1);
|
||||
}
|
||||
|
||||
public T push(T element) {
|
||||
add(element);
|
||||
return element;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user