String st = "FindCaptialWords";
Can we convert above string to character stream using StreamApi?
String st = "FindCaptialWords";
Can we convert above string to character stream using StreamApi?
I just use
Stream<Character> foo = st.chars().mapToObj(c -> Character.valueOf((char) c));
though a stream of codepoints becomes much more useful than a stream of chars
as soon as you need to deal with text outside of the BMP since a single char
/Character
can't hold those values, and so you're back to working with an IntStream
as returned by st.codePoints()
.