Skip to main content
edited tags
Link
Stuart Marks
  • 133.5k
  • 39
  • 215
  • 275
edited tags
Link
Lukas Eder
  • 223.5k
  • 138
  • 731
  • 1.6k
Change the A's and B's in the first proposition so the match the code example.
Source Link
Kong
  • 9.7k
  • 17
  • 77
  • 114

What is the shortest way to express "get new List AB from List BA where condition" via a Java 8 lambda?

Say I have List<Integer> a = Arrays.asList(1, 2, 3, 4, 5) and I want a new List, B, where the value is > 3.

I've read through the new Collections Streams API, but I'm not convinced I have found the best way to do this, and don't want to taint the question with what is probably my less than perfect solution.

What is the shortest way to express "get new List A from List B where condition" via a Java 8 lambda?

Say I have List<Integer> a = Arrays.asList(1, 2, 3, 4, 5) and I want a new List, B, where the value is > 3.

I've read through the new Collections Streams API, but I'm not convinced I have found the best way to do this, and don't want to taint the question with what is probably my less than perfect solution.

What is the shortest way to express "get new List B from List A where condition" via a Java 8 lambda?

Say I have List<Integer> a = Arrays.asList(1, 2, 3, 4, 5) and I want a new List, B, where the value is > 3.

I've read through the new Collections Streams API, but I'm not convinced I have found the best way to do this, and don't want to taint the question with what is probably my less than perfect solution.

Source Link
Kong
  • 9.7k
  • 17
  • 77
  • 114
Loading