Want to create a stream of characters from char array in java

You can use an IntStream to generate the indices followed by mapToObj:

char[] arr = {'a','c','e'};
Stream<Character> cStream = IntStream.range(0, arr.length).mapToObj(i -> arr[i]);

Leave a Comment