arraylist stream in java code example
Example 1: java stream to list
List<String> temp = toCheck.stream().map((a -> a.getFoo())).collect(Collectors.toList());
Example 2: stream java example
public class StreamBuilders
{
public static void main(String[] args)
{
Stream<Integer> stream = Stream.of( new Integer[]{1,2,3,4,5,6,7,8,9} );
stream.forEach(p -> System.out.println(p));
}
}
Example 3: java streams
Arrays.asList("a1", "a2", "a3")
.stream()
.findFirst()
.ifPresent(System.out::println); // a1