private <K> FunctionalMultiMap<K, T> groupIntoMap(
     final FunctionalMultiMap<K, T> map,
     final Function<T, K> groupingFunction,
     FunctionalList<T> values) {
   return values.isEmpty()
       ? map
       : groupIntoMap(
           map.put(groupingFunction.apply(values.head()), values.head()),
           groupingFunction,
           values.tail());
 }
 public FunctionalList<T> append(final T element) {
   return isEmpty()
       ? cons(element, FunctionalList.<T>nil())
       : cons(head(), tail().append(element));
 }
 public <U> FunctionalList<U> map(final Function<T, U> mapping) {
   return isEmpty() ? FunctionalList.<U>nil() : cons(mapping.apply(head()), tail().map(mapping));
 }
 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));
 }