monniasza.collects.selfset.HashSelfSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multimachinebuilder Show documentation
Show all versions of multimachinebuilder Show documentation
Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world.
THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<
The newest version!
/**
*
*/
package monniasza.collects.selfset;
import java.util.HashMap;
import java.util.function.Function;
import mmb.NN;
import mmb.Nil;
import monniasza.collects.Identifiable;
/**
* @author oskar
*/
public class HashSelfSet{
private HashSelfSet() {}
@NN public static <@Nil K, V extends Identifiable> SelfSet<@Nil K, V> createNullable(Class valclass){
return createNullable(valclass, Identifiable::id);
}
@NN public static <@Nil K, V> SelfSet<@Nil K, V> createNullable(Class valclass, Function id){
return new BaseMapSelfSet<>(new HashMap<>(), true, valclass, id);
}
@NN public static <@NN K, V extends Identifiable> SelfSet<@NN K, V> createNonnull(Class valclass){
return createNonnull(valclass, Identifiable::id);
}
@NN public static <@NN K, V> SelfSet<@NN K, V> createNonnull(Class valclass, Function id){
return new BaseMapSelfSet<>(new HashMap<>(), false, valclass, id);
}
}