本文整理汇总了Java中it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java Object2IntOpenHashMap.size方法的具体用法?Java Object2IntOpenHashMap.size怎么用?Java Object2IntOpenHashMap.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
的用法示例。
在下文中一共展示了Object2IntOpenHashMap.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initiateFromArrayWithMap
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
private void initiateFromArrayWithMap(InterdependentProblemPart<?, ?>[] allParts,
Object2IntOpenHashMap<UUID> uuidIntMap) {
keyMap = new Object2IntOpenHashMap<UUID>(allParts.length);
partIdToArrayIdMap = new int[uuidIntMap.size()];
innerValues = new LimitedCommodityStateMap[allParts.length];
keyMap.defaultReturnValue(-1);
Arrays.fill(partIdToArrayIdMap, -1);
for (int i = 0; i < allParts.length; i++) {
if (uuidIntMap.containsKey(allParts[i].getDeviceID())) {
keyMap.put(allParts[i].getDeviceID(), i);
partIdToArrayIdMap[allParts[i].getId()] = i;
innerValues[i] = new LimitedCommodityStateMap();
} else {
throw new IllegalArgumentException("no mapping for specified key");
}
}
}
示例2: UUIDCommodityMap
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
public UUIDCommodityMap(InterdependentProblemPart<?, ?>[] allParts,
Object2IntOpenHashMap<UUID> uuidIntMap,
boolean makeNoMap) {
if (!makeNoMap) {
initiateFromArrayWithMap(allParts, uuidIntMap);
}
keyMap = null;
partIdToArrayIdMap = new int[uuidIntMap.size()];
innerValues = new LimitedCommodityStateMap[allParts.length];
Arrays.fill(partIdToArrayIdMap, -1);
for (int i = 0; i < allParts.length; i++) {
if (uuidIntMap.containsKey(allParts[i].getDeviceID())) {
partIdToArrayIdMap[allParts[i].getId()] = i;
innerValues[i] = new LimitedCommodityStateMap();
} else {
throw new IllegalArgumentException("no mapping for specified key");
}
}
}
示例3: close
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
@Override
public void close() {
synchronized(LuceneLinkTokenizer.this) {
Object2IntOpenHashMap<String> plinks = LuceneLinkTokenizer.this.links;
if(plinks.size() == 0) {
LuceneLinkTokenizer.this.links = links;
}
else {
for(ObjectIterator<Object2IntOpenHashMap.Entry<String>> it = links.object2IntEntrySet().fastIterator(); it.hasNext();) {
Object2IntOpenHashMap.Entry<String> ent = it.next();
plinks.addTo(ent.getKey(), ent.getIntValue());
}
}
links = null;
}
}
示例4: test
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
@Override
public int test() {
final Object2IntOpenHashMap<Integer> m_map = new Object2IntOpenHashMap<>( m_keys.length, m_fillFactor );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ], i );
for ( int i = 0; i < m_keys2.length; ++i )
m_map.put( m_keys2[ i ], i );
return m_map.size();
}
示例5: descending
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; //导入方法依赖的package包/类
/**
* Get a descending list of counted items.
*
* @return List of items.
*/
public static <O> List<Entry<O>> descending(Object2IntOpenHashMap<O> counters) {
ArrayList<Entry<O>> copy = new ArrayList<>(counters.size());
for(Iterator<Object2IntMap.Entry<O>> iter = counters.object2IntEntrySet().fastIterator(); iter.hasNext();) {
// Note: fast iterator will recycle this object!
Object2IntMap.Entry<O> entry = iter.next();
copy.add(new Entry<O>(entry.getKey(), entry.getIntValue()));
}
Collections.sort(copy);
return copy;
}