LongStream iterator() example

Description

LongStream iterator() returns iterator for LongStream.

Syntax

iterator has the following syntax.


PrimitiveIterator.OfLong iterator()

Example

The following example shows how to use iterator.


import java.util.PrimitiveIterator;
import java.util.stream.LongStream;
//from  ww  w  .j  a  v  a 2  s  . c o  m
public class Main {
  public static void main(String[] args) {
    LongStream b = LongStream.empty();
    PrimitiveIterator.OfLong o = b.iterator();
    while(o.hasNext()){
      System.out.println(o.next());  
    }    
  }
}




















Home »
  Java Streams »
    Reference »




Collectors
DoubleStream
DoubleStream.Builder
IntStream
IntStream.Builder
LongStream
LongStream.Builder
Stream
Stream.Builder