CastUtil { public static <T> ToLong<T> castCharToLong(ToChar<T> original) { class CharToLong extends CastToLong<T, ToChar<T>> { private CharToLong(ToChar<T> tToChar) { super(tToChar); } @Override public long applyAsLong(T object) { return inner.applyAsChar(object); } } return new CharToLong(original); } private  CastUtil(); static ToDouble<T> castByteToDouble(ToByte<T> original); static ToDouble<T> castShortToDouble(ToShort<T> original); static ToDouble<T> castIntToDouble(ToInt<T> original); static ToDouble<T> castLongToDouble(ToLong<T> original); static ToDouble<T> castFloatToDouble(ToFloat<T> original); static ToDouble<T> castBigDecimalToDouble(ToBigDecimal<T> original); static ToDouble<T> castBooleanToDouble(ToBoolean<T> original); static ToDouble<T> castCharToDouble(ToChar<T> original); static ToInt<T> castByteToInt(ToByte<T> original); static ToInt<T> castShortToInt(ToShort<T> original); static ToInt<T> castLongToInt(ToLong<T> original); static ToInt<T> castFloatToInt(ToFloat<T> original); static ToInt<T> castDoubleToInt(ToDouble<T> original); static ToInt<T> castBigDecimalToInt(ToBigDecimal<T> original); static ToInt<T> castBooleanToInt(ToBoolean<T> original); static ToInt<T> castCharToInt(ToChar<T> original); static ToLong<T> castByteToLong(ToByte<T> original); static ToLong<T> castShortToLong(ToShort<T> original); static ToLong<T> castIntToLong(ToInt<T> original); static ToLong<T> castFloatToLong(ToFloat<T> original); static ToLong<T> castDoubleToLong(ToDouble<T> original); static ToLong<T> castBigDecimalToLong(ToBigDecimal<T> original); static ToLong<T> castBooleanToLong(ToBoolean<T> original); static ToLong<T> castCharToLong(ToChar<T> original);  }
@Test void castCharToLong() { final ToLong<String> toLong = CastUtil.castCharToLong(string -> string.toCharArray()[0]); assertNotNull(toLong); assertNotEquals(0, toLong.applyAsLong("test")); }