/** * Returns a {@code LongCollector} that produces the sum of the input * elements. If no elements are present, the result is 0. * * @return a {@code LongCollector} that produces the sum of the input * elements */ static LongCollector<?, Long> summing() { return PartialCollector.longSum().asLong((box, i) -> box[0] += i); }
/** * Returns a {@code DoubleCollector} that counts the number of input * elements and returns the result as {@code Long}. If no elements are * present, the result is 0. * * @return a {@code DoubleCollector} that counts the input elements */ static DoubleCollector<?, Long> counting() { return PartialCollector.longSum().asDouble((box, i) -> box[0]++); }
/** * Returns a {@code LongCollector} that counts the number of input elements * and returns the result as {@code Long}. If no elements are present, the * result is 0. * * @return a {@code LongCollector} that counts the input elements */ static LongCollector<?, Long> counting() { return PartialCollector.longSum().asLong((box, i) -> box[0]++); }
/** * Returns an {@code IntCollector} that counts the number of input elements * and returns the result as {@code Long}. If no elements are present, the * result is 0. * * @return an {@code IntCollector} that counts the input elements */ static IntCollector<?, Long> counting() { return PartialCollector.longSum().asInt((box, i) -> box[0]++); }