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]);
More Related Contents:
- Custom thread pool in Java 8 parallel stream
- Is there a concise way to iterate over a stream with indices in Java 8?
- Should I always use a parallel stream when possible?
- How to ensure order of processing in java8 streams?
- What’s the difference between map() and flatMap() methods in Java 8?
- Java 8 lambdas, Function.identity() or t->t
- Ignore duplicates when producing map using streams
- Can you split a stream into two streams?
- Why does parallel stream with lambda in static initializer cause a deadlock?
- Adding up BigDecimals using Streams
- Java 8 Streams FlatMap method example
- Parallel streams, collectors and thread safety
- Java 8, Streams to find the duplicate elements
- Fetch first element of stream matching the criteria
- forEach vs forEachOrdered in Java 8 Stream
- Why is Files.lines (and similar Streams) not automatically closed?
- How to use a Java8 lambda to sort a stream in reverse order?
- Stream.skip behavior with unordered terminal operation
- Using streams to convert a list of objects into a string obtained from the toString method
- Java 8 Collectors.toMap SortedMap
- Why parallel stream get collected sequentially in Java 8
- In Stream reduce method, must the identity always be 0 for sum and 1 for multiplication?
- How to group objects when each object could go in multiple groups?
- Understanding deeply spliterator characteristics
- Why should I use concurrent characteristic in parallel stream with collect?
- Using Java8 Stream to find the highest values from map
- Non-interference exact meaning in Java 8 streams
- Is flatMap guaranteed to be lazy? [duplicate]
- Nested Java 8 parallel forEach loop perform poor. Is this behavior expected?
- Parallel flatMap always sequential