for Each item in List - Java Lambda Stream

Java examples for Lambda Stream:For Each

Description

for Each item in List

Demo Code


//package com.java2s;

import java.util.List;
import java.util.function.Consumer;

public class Main {
    public static <T> void forEach(List<T> list, Consumer<? super T> action) {
        for (T item : list)
            action.accept(item);// w ww. java2 s.c  om
    }
}

Related Tutorials