Questions tagged [lightweight-stream-api]

Use this tag for questions specific to Lightweight-Stream-API which is a stream API from Java 8 rewritten on iterators for Java 7 and below.

18 questions
-1
votes
1 answer

Trying to solve a problem using stream API to find the chunk size. Giving error at .collect(Collectors.toList(ArrayList::new)). Java 8+ Stream

IntStream.iterate(0, i -> i + chunkSize) .limit((long) Math.ceil((double) input.length / chunkSize)) .mapToObj(j -> Arrays.copyOfRange(input, j, j + chunkSize > input.length ? input.length : j + chunkSize)) …
-1
votes
2 answers

Return a List of present objects from a List of Optional objects using Lightweight-Stream-API

Consider I have an array list of Optional objects like List visit = {Optional[Visit], Optional[Visit], ...}. How do i get the Visit object from the Optional and just return those objects as a List? I tried something like this: return…
irobotxx
  • 5,963
  • 11
  • 62
  • 91
-2
votes
3 answers

Union Streams in Java

I think this question is useless, but i can`t find how i can union this code to one line I have List of active Couriers. I am trying to find all free couriers in this list and after that find courier with min distance List afterCheckIsFree…
1
2