package listFW.visitor; import listFW.*; /** * Sums a IList using a reverse accumulation (natural recursion) algorithm. * @author Mathias Ricken - Copyright 2008 - All rights reserved. */ public class SumIntList implements IListAlgo { public Integer emptyCase(IMTList host, Object ... inp) { return 0; } public Integer nonEmptyCase(INEList host, Object ... inp) { return host.getFirst() + host.getRest().execute(this); } }