/** ListVisitor,Integer> class that implements the length() method on List> */ public class LengthVisitor> implements ListVisitor { public Integer forEmptyList(EmptyList e) { return 0; } public Integer forConsList(ConsList cil) { return 1 + cil.rest().visit(this); } }