本文整理汇总了Java中com.google.common.collect.BiMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java BiMap.size方法的具体用法?Java BiMap.size怎么用?Java BiMap.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.BiMap
的用法示例。
在下文中一共展示了BiMap.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertMappings
import com.google.common.collect.BiMap; //导入方法依赖的package包/类
public static void convertMappings(Mappings mappings, BiMap<ClassEntry,ClassEntry> changes) {
// sort the changes so classes are renamed in the correct order
// ie. if we have the mappings a->b, b->c, we have to apply b->c before a->b
LinkedHashMap<ClassEntry,ClassEntry> sortedChanges = Maps.newLinkedHashMap();
int numChangesLeft = changes.size();
while (!changes.isEmpty()) {
Iterator<Map.Entry<ClassEntry,ClassEntry>> iter = changes.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<ClassEntry,ClassEntry> change = iter.next();
if (changes.containsKey(change.getValue())) {
sortedChanges.put(change.getKey(), change.getValue());
iter.remove();
}
}
// did we remove any changes?
if (numChangesLeft - changes.size() > 0) {
// keep going
numChangesLeft = changes.size();
} else {
// can't sort anymore. There must be a loop
break;
}
}
if (!changes.isEmpty()) {
throw new Error("Unable to sort class changes! There must be a cycle.");
}
// convert the mappings in the correct class order
for (Map.Entry<ClassEntry,ClassEntry> entry : sortedChanges.entrySet()) {
mappings.renameObfClass(entry.getKey().getName(), entry.getValue().getName());
}
}
示例2: initFluidIDs
import com.google.common.collect.BiMap; //导入方法依赖的package包/类
/**
* Called by Forge to prepare the ID map for server -> client sync.
* Modders, DO NOT call this.
*/
public static void initFluidIDs(BiMap<Fluid, Integer> newfluidIDs, Set<String> defaultNames)
{
maxID = newfluidIDs.size();
loadFluidDefaults(newfluidIDs, defaultNames);
}