I am looking for a way to map the selected String tab to an array. I am currently doing this with a lambda expression:
stream.map(line -> line.split("\t"));
Is there a way to do this using a method reference? I know that stream.map(String::split("\t")) does not work, but I am wondering if there is an alternative.
stream.map(String::split("\t"))
You can do something like this:
static<T,U,R> Function<T,R> curry(BiFunction<? super T, ? super U, ? extends R> f, U u) { return t -> f.apply(t, u); }
and then you can:
stream.map(curry(String::split, "\t"));