/** * Returns a NonEmptyList of the sublists of this list. * * @return a NonEmptyList of the sublists of this list. */ public NonEmptyList<NonEmptyList<A>> sublists() { return fromList( somes( toList() .toStream() .substreams() .map(F1Functions.o(list -> fromList(list), Conversions.<A>Stream_List())) .toList())) .some(); }
/** * Returns a NonEmptyList of the sublists of this list. * * @return a NonEmptyList of the sublists of this list. */ public NonEmptyList<NonEmptyList<A>> sublists() { return fromList( somes( toList() .toStream() .substreams() .map( F1Functions.o( new F<List<A>, Option<NonEmptyList<A>>>() { public Option<NonEmptyList<A>> f(final List<A> list) { return fromList(list); } }, Conversions.<A>Stream_List())) .toList())) .some(); }