本文整理匯總了Java中gnu.trove.THashMap.put方法的典型用法代碼示例。如果您正苦於以下問題:Java THashMap.put方法的具體用法?Java THashMap.put怎麽用?Java THashMap.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.THashMap
的用法示例。
在下文中一共展示了THashMap.put方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: factorDuplicates
import gnu.trove.THashMap; //導入方法依賴的package包/類
public static <D extends PsiElement> Map<D, List<D>> factorDuplicates(D[] elements, TObjectHashingStrategy<D> strategy) {
if (elements == null || elements.length == 0) return Collections.emptyMap();
THashMap<D, List<D>> map = new THashMap<D, List<D>>(strategy);
for (D element : elements) {
List<D> list = map.get(element);
if (list == null) {
list = new ArrayList<D>();
}
list.add(element);
map.put(element, list);
}
return map;
}
示例2: EdgesIterator
import gnu.trove.THashMap; //導入方法依賴的package包/類
public EdgesIterator (ACRF.UnrolledGraph acrf, Assignment observed)
{
this.graph = acrf;
this.observed = observed;
cliquesByEdge = new THashMap();
for (Iterator it = acrf.unrolledVarSetIterator (); it.hasNext();) {
ACRF.UnrolledVarSet clique = (ACRF.UnrolledVarSet) it.next ();
for (int v1idx = 0; v1idx < clique.size(); v1idx++) {
Variable v1 = clique.get(v1idx);
List adjlist = graph.allFactorsContaining (v1);
for (Iterator factorIt = adjlist.iterator(); factorIt.hasNext();) {
Factor factor = (Factor) factorIt.next ();
if (!cliquesByEdge.containsKey (factor)) { cliquesByEdge.put (factor, new ArrayList()); }
List l = (List) cliquesByEdge.get (factor);
if (!l.contains (clique)) { l.add (clique); }
}
}
}
cursor = cliquesByEdge.keySet().iterator ();
}
示例3: setupLabel2Var
import gnu.trove.THashMap; //導入方法依賴的package包/類
private void setupLabel2Var ()
{
idx2var = new Variable [lblseq.size ()][];
var2label = new THashMap ();
for (int t = 0; t < lblseq.size (); t++) {
Labels lbls = lblseq.getLabels (t);
idx2var[t] = new Variable [lbls.size ()];
for (int j = 0; j < lbls.size (); j++) {
Label lbl = lbls.get (j);
Variable var = new Variable (lbl.getLabelAlphabet ());
var.setLabel ("I"+id+"_VAR[f=" + j + "][tm=" + t + "]");
idx2var[t][j] = var;
var2label.put (var, lbl);
}
}
}
示例4: Record
import gnu.trove.THashMap; //導入方法依賴的package包/類
public Record (String name, LabeledSpans spans) {
this.name = name;
fieldMap = new THashMap ();
for (int i = 0; i < spans.size(); i++) {
LabeledSpan span = spans.getLabeledSpan (i);
if (!span.isBackground()) {
Label tag = span.getLabel ();
Field field = (Field) fieldMap.get (tag);
if (field == null) {
field = new Field (span);
fieldMap.put (tag, field);
} else {
field.addFiller (span);
}
}
}
}
示例5: create
import gnu.trove.THashMap; //導入方法依賴的package包/類
@Override
protected Map<Method, Method> create(Couple<Class<?>> key) {
final THashMap<Method, Method> map = new THashMap<Method, Method>();
for (Method method : key.second.getMethods()) {
Method m = null;
main:
for (Method candidate : key.first.getMethods()) {
if (!candidate.getName().equals(method.getName())) continue;
Class<?>[] cpts = candidate.getParameterTypes();
Class<?>[] mpts = method.getParameterTypes();
if (cpts.length != mpts.length) continue;
for (int i = 0; i < mpts.length; i++) {
Class<?> mpt = mpts[i];
Class<?> cpt = cpts[i];
if (!cpt.isAssignableFrom(mpt)) continue main;
}
m = candidate;
break;
}
if (m != null) map.put(method, m);
}
return map;
}
示例6: testHashMapCloneDoesNotDependOnTheSource
import gnu.trove.THashMap; //導入方法依賴的package包/類
public void testHashMapCloneDoesNotDependOnTheSource() {
THashMap<Integer, int[]> map = new THashMap<Integer, int[]>();
map.put(0, new int[2]);
map.put(1, new int[2]);
THashMap<Integer, int[]> clone = map.clone();
assertEquals(clone.size(), 2);
Set<Integer> keys = clone.keySet();
assertEquals(keys.size(), 2);
assertEquals(ContainerUtil.newHashSet(0,1), keys);
map.clear();
assertEquals(clone.size(), 2);
keys = clone.keySet();
assertEquals(keys.size(), 2);
assertEquals(ContainerUtil.newHashSet(0,1), keys);
}
示例7: loadBlackList
import gnu.trove.THashMap; //導入方法依賴的package包/類
private Map<String, Set<String>> loadBlackList() throws IOException {
final InputStream stream = getClass().getResourceAsStream("/data/methodsBlacklist.txt");
LOG.assertTrue(stream != null, "/data/methodsBlacklist.txt not found");
final THashMap<String, Set<String>> map = new THashMap<String, Set<String>>();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
try {
String line;
while ((line = reader.readLine()) != null) {
final int i = line.indexOf(':');
String className = line.substring(0, i);
String methods = line.substring(i + 1);
map.put(className, new THashSet<String>(StringUtil.split(methods, ",")));
}
}
finally {
reader.close();
}
return map;
}
示例8: loadWhiteList
import gnu.trove.THashMap; //導入方法依賴的package包/類
public static Map<String, Set<String>> loadWhiteList(File input) throws IOException {
final THashMap<String, Set<String>> map = new THashMap<String, Set<String>>();
BufferedReader reader = new BufferedReader(new FileReader(input));
try {
String line;
Set<String> currentClasses = new THashSet<String>();
map.put("", currentClasses);
while ((line = reader.readLine()) != null) {
if (line.startsWith(".")) {
String packageName = line.substring(1);
currentClasses = new THashSet<String>();
map.put(packageName, currentClasses);
}
else {
currentClasses.add(line);
}
}
}
finally {
reader.close();
}
return map;
}
示例9: toXmlDocument
import gnu.trove.THashMap; //導入方法依賴的package包/類
public Document toXmlDocument (String rootEltName, Namespace ns)
{
ArrayList orderedByStart = new ArrayList (extractedSpans);
Collections.sort (orderedByStart, new Comparator () {
public int compare (Object o, Object o1)
{
int start1 = ((Span)o).getStartIdx ();
int start2 = ((Span)o1).getStartIdx ();
return Double.compare (start1, start2);
}
} );
ArrayList roots = new ArrayList (orderedByStart);
THashMap children = new THashMap ();
for (int i = 0; i < orderedByStart.size(); i++) {
LabeledSpan child = (LabeledSpan) orderedByStart.get (i);
for (int j = i-1; j >= 0; j--) {
LabeledSpan parent = (LabeledSpan) orderedByStart.get (j);
if (parent.isSubspan (child)) {
List childList = (List) children.get (parent);
if (childList == null) {
childList = new ArrayList ();
children.put (parent, childList);
}
roots.remove (child);
childList.add (child);
break;
}
}
}
CharSequence doc = (CharSequence) document;
Span wholeDoc = new StringSpan (doc, 0, doc.length ());
return new Document (generateElement (rootEltName, wholeDoc, roots, children));
}