本文整理汇总了Java中gnu.trove.TIntObjectHashMap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java TIntObjectHashMap.remove方法的具体用法?Java TIntObjectHashMap.remove怎么用?Java TIntObjectHashMap.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TIntObjectHashMap
的用法示例。
在下文中一共展示了TIntObjectHashMap.remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: templateToRegex
import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
private static String templateToRegex(String text, TIntObjectHashMap<String> offsetToProperty, Project project) {
List<Object> properties = ContainerUtil.newArrayList(FileTemplateManager.getInstance(project).getDefaultProperties().keySet());
properties.add("PACKAGE_NAME");
String regex = escapeRegexChars(text);
// first group is a whole file header
int groupNumber = 1;
for (Object property : properties) {
String name = property.toString();
String escaped = escapeRegexChars("${" + name + "}");
boolean first = true;
for (int i = regex.indexOf(escaped); i != -1 && i < regex.length(); i = regex.indexOf(escaped, i + 1)) {
String replacement = first ? "([^\\n]*)" : "\\" + groupNumber;
int delta = escaped.length() - replacement.length();
int[] offs = offsetToProperty.keys();
for (int off : offs) {
if (off > i) {
String prop = offsetToProperty.remove(off);
offsetToProperty.put(off - delta, prop);
}
}
offsetToProperty.put(i, name);
regex = regex.substring(0, i) + replacement + regex.substring(i + escaped.length());
if (first) {
groupNumber++;
first = false;
}
}
}
return regex;
}
示例2: removeFromMultiMap
import gnu.trove.TIntObjectHashMap; //导入方法依赖的package包/类
private void removeFromMultiMap(int key, int value) {
final TIntObjectHashMap<TIntArrayList> map = myMultipleValuesMap;
if (map == null) return;
TIntArrayList list = map.get(key);
if (list != null) {
int offset = list.indexOf(value);
if (offset != -1) {
list.remove(offset);
if (list.isEmpty()) {
map.remove(key);
}
}
}
}