package list.visitor; import list.*; public class ReverseHelp implements IListAlgo { public final static ReverseHelp Singleton = new ReverseHelp(); private ReverseHelp() { } /** * @param input receives the accumulated list. * Returns the accumulated list. */ public Object forEmpty(AList host, Object input) { return input; } /** * @param host receives the list. * @param input receives the accumulated list. * Helper to Reverse.java. * Returns the reverse of the list. */ public Object forNonEmpty(AList host, Object input) { return host.getRest().execute(this, ListFactory.Singleton.makeNEList(host.getFirst(), (AList)input)); } }