io.virtdata.libbasics.shared.from_long.to_collection.Set Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-realer Show documentation
Show all versions of virtdata-lib-realer Show documentation
With inspiration from other libraries
package io.virtdata.libbasics.shared.from_long.to_collection;
import io.virtdata.annotations.Categories;
import io.virtdata.annotations.Category;
import io.virtdata.annotations.Example;
import io.virtdata.annotations.ThreadSafeMapper;
import java.util.HashSet;
import java.util.function.LongFunction;
import java.util.function.LongToIntFunction;
/**
* Create a {@code Set} from a long input based on two functions,
* the first to determine the set size, and the second to populate
* the set with object values. The input fed to the second function
* is incremented between elements.
*
* To create Sets of Strings from the String version of the same
* mapping functions, simply use {@link StringSet} instead.
*/
@Categories({Category.collections})
@ThreadSafeMapper
public class Set implements LongFunction> {
private final LongToIntFunction sizeFunc;
private final LongFunction