create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / util / SimpleStack.java
1 package net.sf.openrocket.util;
2
3 import java.util.NoSuchElementException;
4 /**
5  * SimpleStack implementation backed by an ArrayList.
6  * 
7  */
8 public class SimpleStack<T> extends ArrayList<T> {
9
10         public void push( T value ) {
11                 this.add(value);
12         }
13         
14         public T peek() {
15                 if ( size() <= 0 ) {
16                         return null;
17                 }
18                 return this.get( size() -1 );
19         }
20         
21         public T pop() {
22                 if ( size() <= 0 ) {
23                         throw new NoSuchElementException();
24                 }
25                 T value = this.remove( size() -1 );
26                 return value;
27         }
28         
29 }