package list; class EmptyList extends AList { public final static EmptyList Singleton = new EmptyList (); private EmptyList() { } public Object getFirst() { throw new java.util.NoSuchElementException ("Empty has no element."); } public AList getRest() { throw new java.util.NoSuchElementException ("Empty has no tail."); } /** * @param input */ public Object execute(IListAlgo algo, Object input) { return algo.forEmpty (this, input); } }