io.virtdata.libbasics.shared.from_long.to_collection.StringList 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.ArrayList;
import java.util.function.LongFunction;
import java.util.function.LongToIntFunction;
/**
* Create a {@code List} from a long value,
* based on two functions, the first to
* determine the list size, and the second to populate the list with
* String values. The input fed to the second function is incremented
* between elements. Regardless of the object type provided by the
* second function, {@link java.lang.Object#toString()} is used to get
* the value to add to the list.
*
* To create Lists of any type of object simply use {@link List} with
* an specific value mapping function.
*/
@Categories({Category.collections})
@ThreadSafeMapper
public class StringList implements LongFunction> {
private final LongToIntFunction sizeFunc;
private final LongFunction