Java Stream create from constant

Description

Java Stream create from constant

import java.util.stream.Stream;

public class Main {
  public static void main(String[] args) {
    Stream<String> stream  = Stream.of("java2s.com");
    /*from ww w.  java2  s  .  c  om*/
    stream.forEach(System.out::println);
    
    Stream<Integer> stream1  = Stream.of(1,2,3);
    
    stream1.forEach(System.out::println);
    
  }
}



PreviousNext

Related