WeightedMap

public class WeightedMap

Class WeightedMap. Provides weightedmap functionality for the Hytale server.

java.lang.Object > WeightedMap

Field Summary

totalWeight

private double totalWeight

Field totalWeight.

immutable

private boolean immutable

Field immutable.

Method Detail

WeightedMap

public public WeightedMap (@Nonnull final WeightedMap other)

Method WeightedMap.

Parameters:
@Nonnull final WeightedMap other

add

public WeightedMap add (@Nonnull final T element, final double weight)

Method add.

Parameters:
@Nonnull final T element
final double weight

get

public double get (@Nonnull final T element)

Method get.

Parameters:
@Nonnull final T element

pick

public T pick (@Nonnull final Random rand)

Method pick.

Parameters:
@Nonnull final Random rand

size

public int size ()

Method size.

allElements

public List allElements ()

Method allElements.

makeImmutable

public void makeImmutable ()

Method makeImmutable.

isImmutable

public boolean isImmutable ()

Method isImmutable.

forEach

public void forEach (@Nonnull final BiConsumer consumer)

Method forEach.

Parameters:
@Nonnull final BiConsumer consumer

toString

public String toString ()

Method toString.