org.simpleflatmapper.util.SetCollector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-util Show documentation
Show all versions of sfm-util Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.util;
import java.util.HashSet;
import java.util.Set;
/**
* Implementation of {@link Consumer} that collect all the value into a set.
* Equivalent to a {@link java.util.stream.Collectors#toSet()}.
* @param the type of the callback argument
*/
public final class SetCollector implements Consumer {
private final Set set = new HashSet();
@Override
public void accept(final T t) {
set.add(t);
}
/**
*
* @return the collected objects
*/
public Set getSet() {
return set;
}
}