Package org.aksw.commons.index.util
Class SetSuppliers
- java.lang.Object
-
- org.aksw.commons.index.util.SetSuppliers
-
public class SetSuppliers extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSetSuppliers.SetSupplierTreeSet<X>
-
Constructor Summary
Constructors Constructor Description SetSuppliers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SetSupplierforceCast(java.util.function.Supplier<Set<?>> setSupplier)Force cast to the requested type.static <X> SetSupplierforTreeSet(Comparator<X> cmp)static SetSuppliernone()A supplier that supplies null instead of set instances.static <X> CSetSupplier<X>wrapAsCSet(SetSupplier setSupplier, java.util.function.Supplier<X> valueSupplier)
-
-
-
Method Detail
-
wrapAsCSet
public static <X> CSetSupplier<X> wrapAsCSet(SetSupplier setSupplier, java.util.function.Supplier<X> valueSupplier)
-
none
public static SetSupplier none()
A supplier that supplies null instead of set instances. In nested structures such null values may act as placeholders that are replaced in a post-processing step.- Returns:
- 'null' casted to the appropriate type.
-
forceCast
public static SetSupplier forceCast(java.util.function.Supplier<Set<?>> setSupplier)
Force cast to the requested type. Useful for e.g. TreeSets: While e.g. HashSet::new can supply set instances for any generic type, TreeSets are dependent on a comparator which may only work with specific types.- Parameters:
setSupplier-- Returns:
-
forTreeSet
public static <X> SetSupplier forTreeSet(Comparator<X> cmp)
-
-