基本类型流
基本类型流(P29-30)
创建基本类型流(P30)
IntStream stream = IntStream.of(1,1,2,3,5);
stream = Array.stream(values, from, to);//values is an int[] array//Upper bound is excluded
IntStream zeroToNinetyNine = IntStream.range(0,100);
//Upper bound is included
IntStream zeroToHundred = IntStream.rangeClosed(0,100);String sentence = "Hello Word";
IntStream codes = sentence.codePoints();Stream<String> words = ...;
IntStream lengths = words.mapToInt(String::length);基本类型流与对象流的主要差异(P30)
Last updated