Score of 14
14
votes
Why is Collectors.collect not able to infer the types in this stream pipeline?
The following code compiles and runs fine:
List<String> letters = Arrays.asList("a", "b", "c", "d");
letters.stream().gather(
Gatherer....
Score of 9
9
votes
Why is Collectors.collect not able to infer the types in this stream pipeline?
The "obstacle" for the compiler to match the correct types in your example is the lambda. It does not specify its input types and Gatherer is declared with unlimited type parameters, so that ...
Score of 5
5
votes
How to make this stream gatherer threadsafe?
So I am trying to understand how thread safety works with parallel stream
For this, you should consult the API docs for the java.util.stream package, to which Gatherer belongs. Your initializer, ...
Score of 4
4
votes
How to make this stream gatherer threadsafe?
Is my understanding correct or is the stream framework internally synchronizes access to the state objects while performing combiner and finisher operations?
This is closest to the truth. Explicit ...
Score of 3
3
votes
Accepted
How to understand and implement "get each worker tools" and then "get tools" in my Stream API test task for Java developer?
In your example you are doing steps 3.2 and 3.3 in a single stream operation. What you were asked was doing them in two separate operations. The end result was correct, but the way the task was ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
java-stream × 12139java × 11102
java-8 × 6264
lambda × 1461
collections × 883
list × 604
collectors × 559
hashmap × 386
functional-programming × 376
arrays × 313
dictionary × 275
parallel-processing × 269
arraylist × 261
filter × 257
sorting × 214
option-type × 190
string × 160
multithreading × 157
generics × 139
foreach × 139
grouping × 134
reduce × 125
spring × 124
performance × 123
spring-boot × 118