How to convert character array to IntStream in Java

1 Answer

0 votes
import java.util.stream.*; 
 
public class MyClass {
    public static void main(String args[]) {
        Character arr[] = { 'a', 'b', 'c', 'd', 'e', 'f' }; 
  
        IntStream ist = Stream.of(arr).flatMapToInt(IntStream::of); 

        ist.forEach(System.out::println); 
    }
}

 
/*
run:

97
98
99
100
101
102

*/

 



answered Feb 8, 2019 by avibootz

Related questions

1 answer 176 views
176 views asked May 22, 2020 by avibootz
2 answers 145 views
1 answer 180 views
1 answer 150 views
1 answer 163 views
163 views asked Sep 28, 2019 by avibootz
1 answer 201 views
...