public <U> FunctionalList<U> map(final Function<T, U> mapping) { return isEmpty() ? FunctionalList.<U>nil() : cons(mapping.apply(head()), tail().map(mapping)); }
public FunctionalList<T> append(final T element) { return isEmpty() ? cons(element, FunctionalList.<T>nil()) : cons(head(), tail().append(element)); }
private static <T> FunctionalList<T> fromArray(final T[] items, final int start, final int end) { return start == end ? FunctionalList.<T>nil() : cons(items[start], fromArray(items, start + 1, end)); }