public static <T> T produceLevelAware(int level, Producer<T> after, Producer<T> before) { T result = null; if (Build.VERSION.SDK_INT >= level) { if (null != after) result = after.produce(); } else { if (null != before) result = before.produce(); } return result; }
public int reduce(int base, IntBinaryOperator reducerOp) { IntTransformer.ReducerTail reducer = new IntTransformer.ReducerTail(reducerOp, base); Producer producer = producer(reducer); while (producer.produce()) {} return reducer.getResult(); }