Esempio n. 1
0
 /**
  * Returns a nonempty list with the elements of this vector.
  *
  * @return a nonempty list with the elements of this vector.
  */
 public NonEmptyList<A> toNonEmptyList() {
   return NonEmptyList.nel(_1(), List.single(_2()));
 }
Esempio n. 2
0
 /**
  * Returns a nonempty list with the elements of this vector.
  *
  * @return a nonempty list with the elements of this vector.
  */
 public NonEmptyList<A> toNonEmptyList() {
   return NonEmptyList.nel(_1(), tail.toNonEmptyList().toList());
 }
Esempio n. 3
0
 /**
  * Zips this non empty list with the given non empty list to produce a list of pairs. If this list
  * and the given list have different lengths, then the longer list is normalised so this function
  * never fails.
  *
  * @param bs The non empty list to zip this non empty list with.
  * @return A new non empty list with a length the same as the shortest of this list and the given
  *     list.
  */
 public <B> NonEmptyList<P2<A, B>> zip(final NonEmptyList<B> bs) {
   final List<P2<A, B>> list = toList().zip(bs.toList());
   return nel(list.head(), list.tail());
 }