Languages
[Edit]
EN

Java 8 - convert char[] to Stream<Character>

6 points
Created by:
Flimzy
596

Short solution: 

Short solution - another 2 approaches:

In this post we can find 3 different ways of how to create stream of Characters from primitive char[] array in java.

Code snipped with the best way of how to do it:

Below we have full code snipped with those solutions.

1. String.chars()

Edit

Output:

2. IntStream.range()

Edit

Output:

3. CharBuffer.wrap().chars()

Edit

Output:

Merged questions

Edit
  1. Java 8 - create stream of Character objects from primitive char array
  2. How do I convert char[] to Stream<Character> in java?
  3. Java - convert primitive char array to stream of Character objects
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join