public static < T > List < T > iterableOf ( Optional < T > value ) { return value . map ( Arrays :: asList ) . orElse ( Collections . emptyList ( ) ) ; }
If the given value is present returns it as a singleton list . Otherwise returns an empty list .