本文整理匯總了Java中gnu.trove.THashMap.size方法的典型用法代碼示例。如果您正苦於以下問題:Java THashMap.size方法的具體用法?Java THashMap.size怎麽用?Java THashMap.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.THashMap
的用法示例。
在下文中一共展示了THashMap.size方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: removeValue
import gnu.trove.THashMap; //導入方法依賴的package包/類
private void removeValue(int inputId, Object fileSet, Value value) {
if (fileSet == null) {
return;
}
if (fileSet instanceof ChangeBufferingList) {
final ChangeBufferingList changesList = (ChangeBufferingList)fileSet;
changesList.remove(inputId);
if (!changesList.isEmpty()) return;
}
else if (fileSet instanceof Integer) {
if (((Integer)fileSet).intValue() != inputId) {
return;
}
}
if (!(myInputIdMapping instanceof THashMap)) {
myInputIdMapping = null;
myInputIdMappingValue = null;
} else {
THashMap<Value, Object> mapping = (THashMap<Value, Object>)myInputIdMapping;
mapping.remove(value);
if (mapping.size() == 1) {
myInputIdMapping = mapping.keySet().iterator().next();
myInputIdMappingValue = mapping.get((Value)myInputIdMapping);
}
}
}
示例2: copy
import gnu.trove.THashMap; //導入方法依賴的package包/類
@NotNull
public ValueContainerImpl<Value> copy() {
ValueContainerImpl<Value> container = new ValueContainerImpl<Value>();
if (myInputIdMapping instanceof THashMap) {
final THashMap<Value, Object> mapping = (THashMap<Value, Object>)myInputIdMapping;
final THashMap<Value, Object> newMapping = new THashMap<Value, Object>(mapping.size());
container.myInputIdMapping = newMapping;
mapping.forEachEntry(new TObjectObjectProcedure<Value, Object>() {
@Override
public boolean execute(Value key, Object val) {
if (val instanceof ChangeBufferingList) {
newMapping.put(key, ((ChangeBufferingList)val).clone());
} else {
newMapping.put(key, val);
}
return true;
}
});
} else {
container.myInputIdMapping = myInputIdMapping;
container.myInputIdMappingValue = myInputIdMappingValue instanceof ChangeBufferingList ?
((ChangeBufferingList)myInputIdMappingValue).clone():
myInputIdMappingValue;
}
return container;
}