ToFloatNullableImpl implements NullableExpression<T, ToFloat<T>>, ToFloatNullable<T> { @Override public boolean equals(Object o) { if (this == o) return true; else if (!(o instanceof NullableExpression)) return false; final NullableExpression<?, ?> that = (NullableExpression<?, ?>) o; return Objects.equals(original, that.inner()) && Objects.equals(isNull, that.isNullPredicate()); } ToFloatNullableImpl(ToFloat<T> original, Predicate<T> isNull); @Override ToFloat<T> inner(); @Override Predicate<T> isNullPredicate(); @Override Float apply(T t); @Override float applyAsFloat(T t); @Override ToFloat<T> orThrow(); @Override ToFloat<T> orElseGet(ToFloat<T> getter); @Override ToFloat<T> orElse(Float value); @Override ToDoubleNullable<T> mapToDoubleIfPresent(FloatToDoubleFunction mapper); @Override ToFloatNullable<T> mapIfPresent(FloatUnaryOperator mapper); @Override long hash(T object); @Override int compare(T first, T second); @Override boolean isNull(T object); @Override boolean isNotNull(T object); @Override boolean equals(Object o); @Override int hashCode();  }
@Test void testEquals() { final ToFloatNullable<String> copy = instance; assertTrue(instance.equals(copy)); assertFalse(instance.equals(null)); final ToFloatNullable<String> another = new ToFloatNullableImpl<>( instance.inner(), instance.isNullPredicate() ); final ToFloatNullable<String> originalSame = new ToFloatNullableImpl<>( instance.inner(), Objects::isNull ); final ToFloatNullable<String> isNullSame = new ToFloatNullableImpl<>( String::length, instance.isNullPredicate() ); assertTrue(instance.equals(another)); assertFalse(instance.equals(originalSame)); assertFalse(instance.equals(isNullSame)); }