001package basics.collection;
002import java.util.List;
003import java.util.ArrayList;
004import java.util.EmptyStackException;
005final public class IntegerStack {
006        final private List<Integer> l;
007        public IntegerStack() { l = new ArrayList<Integer>(); }
008        public boolean isEmpty() { return l.isEmpty(); }
009        public void push(Integer x) {
010                if (x == null)
011                        throw new IllegalArgumentException();
012                l.add(x);
013        }
014        public Integer pop() {
015                if (l.isEmpty())
016                        throw new EmptyStackException();
017                return l.remove(l.size()-1);
018        }
019}