当前位置: 首页>>代码示例>>Java>>正文


Java TreeMap.put方法代码示例

本文整理汇总了Java中java.util.TreeMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java TreeMap.put方法的具体用法?Java TreeMap.put怎么用?Java TreeMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.TreeMap的用法示例。


在下文中一共展示了TreeMap.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: UploadCdnEntity

import java.util.TreeMap; //导入方法依赖的package包/类
public String UploadCdnEntity(TreeMap<String, Object> params) throws NoSuchAlgorithmException, IOException {
	String actionName = "UploadCdnEntity";

       String entityFile = params.get("entityFile").toString();
       params.remove("entityFile");
       File file = new File(entityFile);        
       if (!file.exists()) {
       	throw new FileNotFoundException();
       }
       
       if (!params.containsKey("entityFileMd5")) {
           params.put("entityFileMd5", MD5.fileNameToMD5(entityFile));
       }
       
       return call(actionName, params, entityFile);
}
 
开发者ID:BennyThink,项目名称:qcloudClient,代码行数:17,代码来源:Cdn.java

示例2: printRow

import java.util.TreeMap; //导入方法依赖的package包/类
private void printRow(TRowResult rowResult) {
  // copy values into a TreeMap to get them in sorted order

  TreeMap<String, TCell> sorted = new TreeMap<String, TCell>();
  for (Map.Entry<ByteBuffer, TCell> column : rowResult.columns.entrySet()) {
    sorted.put(utf8(column.getKey().array()), column.getValue());
  }

  StringBuilder rowStr = new StringBuilder();
  for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
    rowStr.append(entry.getKey());
    rowStr.append(" => ");
    rowStr.append(utf8(entry.getValue().value.array()));
    rowStr.append("; ");
  }
  System.out.println("row: " + utf8(rowResult.row.array()) + ", cols: " + rowStr);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:HttpDoAsClient.java

示例3: testCombMNZ

import java.util.TreeMap; //导入方法依赖的package包/类
/**
 * Test combMNZ.
 */
@Test
public void testCombMNZ() {

    final RankAggregation borda = RankAggregation.build("combMNZ", maxRank);

    borda.computeUserRanking(runs, userID, allItems, ranking);

    final TreeMap<Double, LongSet> userRanking = new TreeMap<Double, LongSet>();
    userRanking.put(12.0, HashLongSets.newUpdatableSet(new long[] { 3 }));
    userRanking.put(10.0, HashLongSets.newUpdatableSet(new long[] { 1 }));
    userRanking.put(5.0, HashLongSets.newUpdatableSet(new long[] { 2 }));
    userRanking.put(2.0, HashLongSets.newUpdatableSet(new long[] { 4 }));

    Assert.assertEquals(userRanking, ranking);

}
 
开发者ID:dvalcarce,项目名称:metarecsys,代码行数:20,代码来源:TestMetaRecSys.java

示例4: addNotificationSocket

import java.util.TreeMap; //导入方法依赖的package包/类
private void addNotificationSocket(final TreeMap<Integer, Entry> entries,
    FdSet fdSet) {
  entries.put(notificationSockets[1].fd, 
      new Entry(notificationSockets[1], new NotificationHandler()));
  try {
    notificationSockets[1].refCount.reference();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  fdSet.add(notificationSockets[1].fd);
  if (LOG.isTraceEnabled()) {
    LOG.trace(this + ": adding notificationSocket " +
        notificationSockets[1].fd + ", connected to " +
        notificationSockets[0].fd);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:DomainSocketWatcher.java

示例5: createAllDisplayOrderOutputs

import java.util.TreeMap; //导入方法依赖的package包/类
/**
    * Check the display order embedded in the condition name. The name MUST start with
    * OUTPUT_NAME_NOMINATION_SELECTION.
    */
   private TreeMap<String, ToolOutput> createAllDisplayOrderOutputs(ITaskListService taskListService,
    Long toolSessionId, Long learnerId) {

TreeMap<String, ToolOutput> output = null;

int num = taskListService.getNumTasksCompletedByUser(toolSessionId, learnerId);
ToolOutput toolOutput = new ToolOutput(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED,
	getI18NText(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED, true), new Long(num));
output.put(OUTPUT_NAME_LEARNER_NUM_TASKS_COMPLETED, toolOutput);

String i18nDescription = getI18NText(OUTPUT_NAME_TOOL_CONDITION, true);
TaskList taskList = taskListService.getTaskListBySessionId(toolSessionId);
Set<TaskListCondition> conditions = taskList.getConditions();
for (TaskListCondition condition : conditions) {
    String name = buildConditionName(OUTPUT_NAME_TOOL_CONDITION, condition.getName());
    boolean check = taskListService.checkCondition(condition.getName(), toolSessionId, learnerId);
    output.put(name, new ToolOutput(name, i18nDescription, check));
}

return output;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:TaskListOutputFactory.java

示例6: getAllFieldsMutable

import java.util.TreeMap; //导入方法依赖的package包/类
/** Internal helper which returns a mutable map. */
private Map<FieldDescriptor, Object> getAllFieldsMutable() {
  final TreeMap<FieldDescriptor, Object> result =
    new TreeMap<FieldDescriptor, Object>();
  final Descriptor descriptor = internalGetFieldAccessorTable().descriptor;
  for (final FieldDescriptor field : descriptor.getFields()) {
    if (field.isRepeated()) {
      final List value = (List) getField(field);
      if (!value.isEmpty()) {
        result.put(field, value);
      }
    } else {
      if (hasField(field)) {
        result.put(field, getField(field));
      }
    }
  }
  return result;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:GeneratedMessage.java

示例7: handleRequest

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    boolean decodeDone = exchange.getConnection().getUndertowOptions().get(UndertowOptions.DECODE_URL, true);
    if (!decodeDone) {
        final StringBuilder sb = new StringBuilder();
        final boolean decodeSlash = exchange.getConnection().getUndertowOptions().get(UndertowOptions.ALLOW_ENCODED_SLASH, false);
        exchange.setRequestPath(URLUtils.decode(exchange.getRequestPath(), charset, decodeSlash, sb));
        exchange.setRelativePath(URLUtils.decode(exchange.getRelativePath(), charset, decodeSlash, sb));
        exchange.setResolvedPath(URLUtils.decode(exchange.getResolvedPath(), charset, decodeSlash, sb));
        if (!exchange.getQueryString().isEmpty()) {
            final TreeMap<String, Deque<String>> newParams = new TreeMap<>();
            for (Map.Entry<String, Deque<String>> param : exchange.getQueryParameters().entrySet()) {
                final Deque<String> newVales = new ArrayDeque<>(param.getValue().size());
                for (String val : param.getValue()) {
                    newVales.add(URLUtils.decode(val, charset, true, sb));
                }
                newParams.put(URLUtils.decode(param.getKey(), charset, true, sb), newVales);
            }
            exchange.getQueryParameters().clear();
            exchange.getQueryParameters().putAll(newParams);
        }
    }
    next.handleRequest(exchange);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:URLDecodingHandler.java

示例8: OrganizationDictionary

import java.util.TreeMap; //导入方法依赖的package包/类
@Inject
public OrganizationDictionary(NTDictionary dictionary, Environment environment) throws IOException {
    this.dictionary = dictionary;

    long start = System.currentTimeMillis();

    MynlpResource resource = environment.loadResource("org.dict.tr", "inner://dictionary/organization/nt.tr.txt");


    //转移矩阵
    transformMatrixDictionary = new EnumTransformMatrix<>(resource);

    // AC tree
    {
        TreeMap<String, String> map = new TreeMap<>();
        for (String pattern : NTPattern.patterns) {
            map.put(pattern, pattern);
        }

        AhoCoraickDoubleArrayTrieBuilder<String> acdaBuilder = new AhoCoraickDoubleArrayTrieBuilder<>();
        this.trie = acdaBuilder.build(map);
    }


    logger.info("PlaceDictionary 加载成功,耗时" + (System.currentTimeMillis() - start) + "ms");
}
 
开发者ID:mayabot,项目名称:mynlp,代码行数:27,代码来源:OrganizationDictionary.java

示例9: load

import java.util.TreeMap; //导入方法依赖的package包/类
public boolean load(ByteArray byteArray)
{
    idToLabelMap = new String[byteArray.nextInt()];
    TreeMap<String, Integer> map = new TreeMap<String, Integer>();
    for (int i = 0; i < idToLabelMap.length; i++)
    {
        idToLabelMap[i] = byteArray.nextString();
        map.put(idToLabelMap[i], i);
    }

    return trie.build(map) == 0;
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:13,代码来源:Alphabet.java

示例10: testPutAllGlobalLock

import java.util.TreeMap; //导入方法依赖的package包/类
@Test
public void testPutAllGlobalLock() throws Exception {
  TreeMap trialMap = new TreeMap();
  for (long i = 0; i < 1000; i++) {
    trialMap.put(new Long(i), new Long(i));
  }
  testRegion.putAll(trialMap);
  ThreadUtils.join(this.thread, 30 * 1000);
  assertTrue(this.testOK);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:PutAllGlobalLockJUnitTest.java

示例11: buildIndexes

import java.util.TreeMap; //导入方法依赖的package包/类
private TreeMap<String, Integer> buildIndexes(Map<String, List<String>> passwordsByLetter) {
    TreeMap<String, Integer> baseIndexes = Maps.newTreeMap();
    int indexSum = 0;
    for (List<String> currList : passwordsByLetter.values()) {
        String firstLetter = extractFirstWordsFirstLetter(currList);
        baseIndexes.put(firstLetter, indexSum);
        indexSum += currList.size();
    }

    return baseIndexes;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:12,代码来源:WordsExtractor.java

示例12: intToRoman

import java.util.TreeMap; //导入方法依赖的package包/类
public String intToRoman(int num) {
    TreeMap<Integer, String> map = new TreeMap<>();

    map.put(1000, "M");
    map.put(900, "CM");
    map.put(500, "D");
    map.put(400, "CD");
    map.put(100, "C");
    map.put(90, "XC");
    map.put(50, "L");
    map.put(40, "XL");
    map.put(10, "X");
    map.put(9, "IX");
    map.put(5, "V");
    map.put(4, "IV");
    map.put(1, "I");

    StringBuilder result = new StringBuilder();

    while (num > 0) {
        int key = map.floorKey(num);

        result.append(map.get(key));

        num -= key;
    }

    return result.toString();
}
 
开发者ID:viatsko,项目名称:hack,代码行数:30,代码来源:IntegerToRoman.java

示例13: shiftRight

import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public ArrayData shiftRight(final int by) {
    final TreeMap<Long, Object> newSparseMap = new TreeMap<>();
    // Move elements from underlying to sparse map if necessary
    final long len = underlying.length();
    if (len + by > maxDenseLength) {
        // Length of underlying array after shrinking, before right-shifting
        final long tempLength = Math.max(0, maxDenseLength - by);
        for (long i = tempLength; i < len; i++) {
            if (underlying.has((int) i)) {
                newSparseMap.put(i + by, underlying.getObject((int) i));
            }
        }
        underlying = underlying.shrink((int) tempLength);
        underlying.setLength(tempLength);
    }

    underlying = underlying.shiftRight(by);

    for (final Map.Entry<Long, Object> entry : sparseMap.entrySet()) {
        final long newIndex = entry.getKey() + by;
        newSparseMap.put(newIndex, entry.getValue());
    }

    sparseMap = newSparseMap;
    setLength(length() + by);

    return this;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:SparseArrayData.java

示例14: getResourceRoots

import java.util.TreeMap; //导入方法依赖的package包/类
TreeMap<String, String> getResourceRoots() {
    TreeMap<String, String> roots = new TreeMap<String, String>();

    if (mfmSettings.get(MFM_Constants.ROMS_FULL_SET_DIRECTORY) != null) {
        roots.put(MFM_Constants.ROMS_FULL_SET_DIRECTORY,
                (String) mfmSettings.get(MFM_Constants.ROMS_FULL_SET_DIRECTORY));
    }

    if (mfmSettings.get(MFM_Constants.CHDS_FULL_SET_DIRECTORY) != null) {
        roots.put(MFM_Constants.CHDS_FULL_SET_DIRECTORY,
                (String) mfmSettings.get(MFM_Constants.CHDS_FULL_SET_DIRECTORY));
    }

    if (mfmSettings.get(MFM_Constants.SOFTWARELIST_ROMS_FULL_SET_DIRECTORY) != null) {
        roots.put(MFM_Constants.SOFTWARELIST_ROMS_FULL_SET_DIRECTORY,
                (String) mfmSettings.get(MFM_Constants.SOFTWARELIST_ROMS_FULL_SET_DIRECTORY));
    }

    if (mfmSettings.get(MFM_Constants.SOFTWARELIST_CHDS_FULL_SET_DIRECTORY) != null) {
        roots.put(MFM_Constants.SOFTWARELIST_CHDS_FULL_SET_DIRECTORY,
                (String) mfmSettings.get(MFM_Constants.SOFTWARELIST_CHDS_FULL_SET_DIRECTORY));
    }

    if (mfmSettings.get(MFM_Constants.EXTRAS_FULL_SET_DIRECTORY) != null) {
        roots.put(MFM_Constants.EXTRAS_FULL_SET_DIRECTORY,
                (String) mfmSettings.get(MFM_Constants.EXTRAS_FULL_SET_DIRECTORY));
    }

    if (mfmSettings.get(MFM_Constants.MAME_VIDS_DIRECTORY) != null) {
        roots.put(MFM_Constants.MAME_VIDS_DIRECTORY,
                (String) mfmSettings.get(MFM_Constants.MAME_VIDS_DIRECTORY));
    }
    return roots;
}
 
开发者ID:phweda,项目名称:MFM,代码行数:35,代码来源:MFMSettings.java

示例15: insertMap

import java.util.TreeMap; //导入方法依赖的package包/类
public TreeMap<String,String> insertMap(){
    TreeMap<String, String> maps = new TreeMap<>();

    for (int i = 0 ; i < 10;i++) {
        maps.put(i + "", 10 * i + "");
    }

    return maps;
}
 
开发者ID:byhieg,项目名称:JavaTutorial,代码行数:10,代码来源:TreeMapExample.java


注:本文中的java.util.TreeMap.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。