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