We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
map(toTuple(Hare::getId,Hare::getName, Hare::getAge));
Similar to toMap() collector extractors
toMap()
The text was updated successfully, but these errors were encountered:
interface TupleMapper<T> { Function<T, ?> getMapper(int index); } interface Tuple1Mapper<T, T0> extends TupleMapper<T>, Function<T, Tuple1<T0>> { } interface Tuple2Mapper<T, T0, T1> extends TupleMapper<T>, Function<T, Tuple2<T0, T1>> { } static class Tuple1MapperImpl<T, T0> implements Tuple1Mapper<T, T0> { private final Function<T, T0> mapper0; public Tuple1MapperImpl(Function<T, T0> mapper0) { this.mapper0 = requireNonNull(mapper0); } @Override public Tuple1<T0> apply(T t) { return Tuples.of(mapper0.apply(t)); } @Override public Function<T, ?> getMapper(int index) { if (index == 0) { return mapper0; }; throw new IllegalArgumentException(); } } private <T, T0> Tuple1Mapper<T, T0> tupleMapper(Function<T, T0> mapper0) { return new Tuple1MapperImpl<>(mapper0); //return (T t) -> Tuples.of(mapper0.apply(t)); } private <T, T0, T1> Function<T, Tuple2<T0, T1>> tupleMapper(Function<T, T0> mapper0, Function<T, T1> mapper1) { return (T t) -> Tuples.of(mapper0.apply(t), mapper1.apply(t)); }
Sorry, something went wrong.
minborg
No branches or pull requests
Similar to
toMap()
collector extractorsThe text was updated successfully, but these errors were encountered: