예제 #1
0
 /**
  * Prepend the given value to this list.
  *
  * @param a The value to prepend.
  * @return A non-empty list with an extra element.
  */
 public NonEmptyList<A> cons(final A a) {
   return nel(a, tail.cons(head));
 }
예제 #2
0
 /**
  * Returns a <code>List</code> projection of this list.
  *
  * @return A <code>List</code> projection of this list.
  */
 public List<A> toList() {
   return tail.cons(head);
 }