Example usage for java.util Iterator forEachRemaining

List of usage examples for java.util Iterator forEachRemaining

Introduction

In this page you can find the example usage for java.util Iterator forEachRemaining.

Prototype

default void forEachRemaining(Consumer<? super E> action) 

Source Link

Document

Performs the given action for each remaining element until all elements have been processed or the action throws an exception.

Usage

From source file:peapod.FramedGraph.java

public <F, E extends Element> List<F> frame(Iterator<E> it, Class<F> clazz) {
    List<F> result = new ArrayList<>();
    it.forEachRemaining(e -> {
        IFramer<E, F> framer = registry.get(e, clazz);
        result.add(framer.frame(e, this));
    });//  w w w  .j  a  v a2  s  .com
    return Collections.unmodifiableList(result);
}