IntStream to String

suggest change

Java does not have a CharStream. When working with Strings, one option is to get an IntStream of Unicode code points from String.codePoints():

public IntStream stringToIntStream(String in) {
  return in.codePoints();
}

The conversion the other way, from an IntStream of code points back to a String, can be done as follows:

public String intStreamToString(IntStream intStream) {
  return intStream.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString();
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents