Skip to content

Unable to get simplest example working #38

Answered by g4s8
dudeNumber4 asked this question in Q&A
Discussion options

You must be logged in to vote

@dudeNumber4 you are looking for accept() method: https://github.com/g4s8/tuples/blob/master/src/main/java/wtf/g4s8/tuples/Pair.java#L24

apply() expects a bi-function with a result: BiFunction<? super T, ? super U, ? extends R>, it can't accept void consumer like println, but accept takes BiConsumer<? super T, ? super U> argument.

This example works fine:

var p = Pair.of(1, "you gotta have a pair");
p.accept((i, s) -> System.out.println(s));

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dudeNumber4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants