Java examples for Lambda Stream:BinaryOperator
collect from List of Item using Lambda
//package com.java2s; import java.util.List; import java.util.function.BinaryOperator; public class Main { public static <T> T collect(List<T> entries, BinaryOperator<T> operation, T starter) { for (T entry : entries) { starter = operation.apply(starter, entry); }// w ww . j a v a 2 s. c om return (starter); } }