List of usage examples for java.util List stream
default Stream<E> stream()
From source file:Main.java
public static void main(String[] args) { List<Integer> l = getDatas(); System.out.println(l.stream().map((a) -> (a.toString())).reduce((a, b) -> (a + b)).orElse("ko")); }
From source file:Main.java
public static void main(String[] args) { List<String> stringList = Arrays.asList("1", "2", "3", "4", "5"); stringList.stream().mapToLong(n -> Long.parseLong(n)).filter(n -> n % 2 == 0).forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<String> stringList = Arrays.asList("1", "1", "2", "3", "4"); stringList.stream().limit(2).peek(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<String> stringList = Arrays.asList("5", "1", "2", "3", "4"); stringList.stream().sorted().forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<String> stringList = Arrays.asList("1", "1", "2", "3", "4"); stringList.stream().skip(2).forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<String> stringList = Arrays.asList("1", "2", "3", "4", "5"); stringList.stream().mapToInt(n -> Integer.parseInt(n)).filter(n -> n % 2 == 0).forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<String> stringList = Arrays.asList("1", "1", "2", "3", "4"); stringList.stream().distinct().forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); boolean o = numbers.stream().noneMatch(n -> n % 2 == 0); System.out.println(o);// w w w . j ava 2s . co m }
From source file:Main.java
public static void main(String[] args) { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); numbers.stream().map(value -> value * 2).forEach(System.out::println); }
From source file:Main.java
public static void main(String[] args) { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); numbers.stream().filter(value -> value % 2 == 0).forEach(System.out::println); }