本文整理匯總了Java中it.unimi.dsi.fastutil.doubles.Double2ObjectMap類的典型用法代碼示例。如果您正苦於以下問題:Java Double2ObjectMap類的具體用法?Java Double2ObjectMap怎麽用?Java Double2ObjectMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Double2ObjectMap類屬於it.unimi.dsi.fastutil.doubles包,在下文中一共展示了Double2ObjectMap類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getWeightedRandomReversed
import it.unimi.dsi.fastutil.doubles.Double2ObjectMap; //導入依賴的package包/類
@Nullable
public static <T> T getWeightedRandomReversed(Random random, Double2ObjectMap<T> choices)
{
double i = 0;
DoubleSet doubles = choices.keySet();
for (DoubleIterator iterator = doubles.iterator(); iterator.hasNext(); )
{
double x = iterator.nextDouble();
i += x;
}
i = getRandomDouble(random, 0, i);
for (Double2ObjectMap.Entry<T> entry : choices.double2ObjectEntrySet())
{
i -= entry.getDoubleKey();
if (i < 0)
{
return entry.getValue();
}
}
return null;
}
示例2: getWeightedRandomReversed
import it.unimi.dsi.fastutil.doubles.Double2ObjectMap; //導入依賴的package包/類
@Nullable
public <T> T getWeightedRandomReversed(Double2ObjectMap<T> choices)
{
return DioriteRandomUtils.getWeightedRandomReversed(this, choices);
}
示例3: iterator
import it.unimi.dsi.fastutil.doubles.Double2ObjectMap; //導入依賴的package包/類
public Iterator<Double2ObjectMap.Entry<V>> iterator() {
return new EntryIterator();
}