/** * Returns a potential non-empty list from the given list. A non-value is returned if the given * list is empty. * * @param as The list to construct a potential non-empty list with. * @return A potential non-empty list from the given list. */ public static <A> Option<NonEmptyList<A>> fromList(final List<A> as) { return as.isEmpty() ? Option.<NonEmptyList<A>>none() : some(nel(as.head(), as.tail())); }