private <C extends Collection<T>> GenericCollectionPropertyBuilder<T, C> toCollection(Supplier<C> emptyCollSupplier) { if (isDefaultValueSet()) { throw new IllegalStateException("The default value is already set!"); } GenericCollectionPropertyBuilder<T, C> result = new GenericCollectionPropertyBuilder<>(getName(), getParser(), emptyCollSupplier, getType()); for (PropertyConstraint<? super T> validator : getConstraints()) { result.require(validator.toCollectionConstraint()); } return result; }
private <C extends Collection<T>> GenericCollectionPropertyBuilder<T, C> toCollection(Supplier<C> emptyCollSupplier) { if (isDefaultValueSet()) { throw new IllegalStateException("The default value is already set!"); } GenericCollectionPropertyBuilder<T, C> result = new GenericCollectionPropertyBuilder<>(getName(), getParser(), emptyCollSupplier, getType()); for (PropertyConstraint<? super T> validator : getConstraints()) { result.require(validator.toCollectionConstraint()); } return result; }