private static Collector<String, List<List<String>>, List<List<String>>> splitBySeparator(Predicate<String> sep) {
        return Collector.of(() -> new ArrayList<List<String>>(Arrays.asList(new ArrayList<>())),
                (l, elem) -> {
                    if (sep.test(elem)) {
                        l.add(new ArrayList<>());
                    } else l.get(l.size() - 1).add(elem);
                },
                (l1, l2) -> {
                    l1.get(l1.size() - 1).addAll(l2.remove(0));
                    l1.addAll(l2);
                    return l1;
                });
    }
private static Collector < String , List < List < String > > , List < List < String > > > splitBySeparator ( Predicate < String > sep ) { return Collector . of ( ( ) -> new ArrayList < List < String > > ( Arrays . asList ( new ArrayList < > ( ) ) ) , ( l , elem ) -> { if ( sep . test ( elem ) ) { l . add ( new ArrayList < > ( ) ) ; } else l . get ( l . size ( ) - 1 ) . add ( elem ) ; } , ( l1 , l2 ) -> { l1 . get ( l1 . size ( ) - 1 ) . addAll ( l2 . remove ( 0 ) ) ; l1 . addAll ( l2 ) ; return l1 ; } ) ; }
so : 29095967