本文整理汇总了Java中it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java Int2IntOpenHashMap.size方法的具体用法?Java Int2IntOpenHashMap.size怎么用?Java Int2IntOpenHashMap.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap
的用法示例。
在下文中一共展示了Int2IntOpenHashMap.size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; //导入方法依赖的package包/类
@Override
public int test() {
final Int2IntOpenHashMap m_map = new Int2IntOpenHashMap( m_keys.length, m_fillFactor );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ],m_keys[ i ] );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ],m_keys[ i ] );
return m_map.size();
}
示例2: merge
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; //导入方法依赖的package包/类
private Int2IntOpenHashMap merge(Int2IntOpenHashMap counts1, Int2IntOpenHashMap counts2) {
Int2IntOpenHashMap large = counts1.size() > counts2.size() ? counts1 : counts2;
Int2IntOpenHashMap small = counts1.size() > counts2.size() ? counts2 : counts1;
Int2IntOpenHashMap result = large.clone();
for (Int2IntOpenHashMap.Entry entry : small.int2IntEntrySet()) {
result.addTo(entry.getIntKey(), entry.getIntValue());
}
return result;
}
示例3: swapCounts
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; //导入方法依赖的package包/类
private Int2IntOpenHashMap swapCounts(Int2IntOpenHashMap origCounts, Int2IntOpenHashMap countsToSwap) {
if (countsToSwap != null) {
if (countsToSwap.size() > 1) {
throw new RuntimeException("Unexpected counts!");
}
int countToSwap = countsToSwap.get(DUMMY_CLUSTER);
if (countToSwap > 0) {
origCounts = origCounts.clone();
origCounts.addTo(DUMMY_CLUSTER, countToSwap);
reduceValue(origCounts, currClusterOfPhrase, countToSwap);
}
}
return origCounts;
}