python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
Why casting is required with compose method but not with andThen Method
I have following expression that gets executed successfully:
Function<Long,Long> y = ((Function<Long,Long>)(x -> x*x)).andThen(x -> x+1).andThen(x -> x+2);
I understand why casti...
Tarun
Votes: 0
Answers: 2
Why and When should I use Functional Interfaces
Say I am writing a Consumer which prints something on the console. Then why shouldn't I directly use the System.out.println() method instead of creating a Consumer?
Similarly, say I want to return a r...

Ashish Singh
Votes: 0
Answers: 2
What would a compose method in the BiFunction interface look like?
The Function interface has the compose() and andThen() methods while the BiFunction interface only has the andThen() method. My question is simply how could the corresponding method be implemented? I'...
PianoMastR64
Votes: 0
Answers: 1
Correct way to apply different fucntions based on condition in stream
What would be the correct way to implement this functional logic with streams?
Stream through list of items
Check if condition 1 passes, if so apply function 1 to the item.
Check if condition 2 pass...
ems19
Votes: 0
Answers: 1