PlusUtil { public static <T> ToShort<T> shortPlusShort(ToShort<T> first, ToShort<T> second) { class ShortPlusShort extends AbstractPlus<T, ToShort<T>, ToShort<T>> implements ToShort<T> { private ShortPlusShort(ToShort<T> first, ToShort<T> second) { super(first, second); } @Override public short applyAsShort(T object) { return (short) (firstInner.applyAsShort(object) + secondInner.applyAsShort(object)); } } return new ShortPlusShort(first, second); } private  PlusUtil(); static ToShort<T> bytePlusByte(ToByte<T> first, byte second); static ToInt<T> bytePlusInt(ToByte<T> first, int second); static ToLong<T> bytePlusLong(ToByte<T> first, long second); static ToShort<T> bytePlusByte(ToByte<T> first, ToByte<T> second); static ToInt<T> shortPlusByte(ToShort<T> first, byte second); static ToInt<T> shortPlusInt(ToShort<T> first, int second); static ToLong<T> shortPlusLong(ToShort<T> first, long second); static ToShort<T> shortPlusShort(ToShort<T> first, ToShort<T> second); static ToInt<T> intPlusByte(ToInt<T> first, byte second); static ToInt<T> intPlusInt(ToInt<T> first, int second); static ToLong<T> intPlusLong(ToInt<T> first, long second); static ToInt<T> intPlusByte(ToInt<T> first, ToByte<T> second); static ToInt<T> intPlusInt(ToInt<T> first, ToInt<T> second); static ToLong<T> longPlusByte(ToLong<T> first, byte second); static ToLong<T> longPlusInt(ToLong<T> first, int second); static ToLong<T> longPlusLong(ToLong<T> first, long second); static ToLong<T> longPlusInt(ToLong<T> first, ToInt<T> second); static ToLong<T> longPlusLong(ToLong<T> first, ToLong<T> second); static ToFloat<T> floatPlusInt(ToFloat<T> first, int second); static ToDouble<T> floatPlusLong(ToFloat<T> first, long second); static ToFloat<T> floatPlusFloat(ToFloat<T> first, float second); static ToFloat<T> floatPlusInt(ToFloat<T> first, ToInt<T> second); static ToDouble<T> floatPlusLong(ToFloat<T> first, ToLong<T> second); static ToFloat<T> floatPlusFloat(ToFloat<T> first, ToFloat<T> second); static ToDouble<T> doublePlusInt(ToDouble<T> first, int second); static ToDouble<T> doublePlusLong(ToDouble<T> first, long second); static ToDouble<T> doublePlusDouble(ToDouble<T> first, double second); static ToDouble<T> doublePlusInt(ToDouble<T> first, ToInt<T> second); static ToDouble<T> doublePlusLong(ToDouble<T> first, ToLong<T> second); static ToDouble<T> doublePlusDouble(ToDouble<T> first, ToDouble<T> second);  }
@Test void shortPlusShort() { final ToShort<Short> instance = PlusUtil.shortPlusShort(s -> s, s -> s); assertEquals(2, instance.applyAsShort((short) 1)); }