fork download
  1. import java.util.*;
  2. import java.util.stream.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class Ideone {
  7. public static void main (String[] args) throws java.lang.Exception{
  8. List<String> strs = Arrays.asList("anus", "pyos");
  9. List<Integer> ints = Collections.singletonList(265);
  10.  
  11. Stream.of(strs, ints)
  12. .flatMap(Collection::stream)
  13. .filter("anus"::equals)
  14. .findAny()
  15. .ifPresent(System.out::println); // anus
  16.  
  17. Stream.of(strs, ints)
  18. .flatMap(Collection::stream)
  19. .filter(o -> Integer.valueOf(265).equals(o))
  20. .findAny()
  21. .ifPresent(System.out::println); // 265
  22.  
  23. Stream.of(strs, ints)
  24. .flatMap(Collection::stream)
  25. .parallel()
  26. .filter("ty hui"::equals)
  27. .findAny()
  28. .ifPresent(System.out::println); // no output
  29. }
  30. }
Success #stdin #stdout 0.24s 321152KB
stdin
Standard input is empty
stdout
anus
265