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]);
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]);