com.natpryce.makeiteasy.NewCollectionDonor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of make-it-easy Show documentation
Show all versions of make-it-easy Show documentation
A tiny framework that makes it easy to write Test Data Builders in Java
package com.natpryce.makeiteasy;
import java.util.Collection;
import static java.util.Arrays.asList;
public abstract class NewCollectionDonor, E> implements Donor {
private final Iterable extends Donor extends E>> elementDonors;
@SafeVarargs
public NewCollectionDonor(Donor extends E>... elementDonors) {
this(asList(elementDonors));
}
public NewCollectionDonor(Iterable extends Donor extends E>> elementDonors) {
this.elementDonors = elementDonors;
}
@Override
public T value() {
T newCollection = newCollection();
for (Donor extends E> elementDonor : elementDonors) {
newCollection.add(elementDonor.value());
}
return newCollection;
}
protected abstract T newCollection();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy