Unable to get simplest example working #38
-
Trying to use Pair. Using jshell 17, passing your jar in --class-path. Code follows. What am I missing?
Error: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@dudeNumber4 you are looking for
This example works fine: var p = Pair.of(1, "you gotta have a pair");
p.accept((i, s) -> System.out.println(s)); |
Beta Was this translation helpful? Give feedback.
@dudeNumber4 you are looking for
accept()
method: https://github.com/g4s8/tuples/blob/master/src/main/java/wtf/g4s8/tuples/Pair.java#L24apply()
expects a bi-function with a result:BiFunction<? super T, ? super U, ? extends R>
, it can't acceptvoid
consumer likeprintln
, butaccept
takesBiConsumer<? super T, ? super U>
argument.This example works fine: