/** * Add a constraint that verifies that neither the key nor the value is * null. If either is null, a {@link NullPointerException} is thrown. * * @return */ @SuppressWarnings("unchecked") public Mapper<K, V> keyAndValueNotNull() { return addConstraint((MapConstraint<K, V>) MapConstraints.notNull()); }
/** * Add a constrained view of the delegate map, using the specified constraint * * @param constraint * @return */ private Mapper<K, V> addConstraint(MapConstraint<K, V> constraint) { this.delegate = Optional.of(MapConstraints.constrainedMap(delegate.get(), constraint)); return this; }