當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeMap.entrySet方法代碼示例

本文整理匯總了Java中java.util.TreeMap.entrySet方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeMap.entrySet方法的具體用法?Java TreeMap.entrySet怎麽用?Java TreeMap.entrySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.TreeMap的用法示例。


在下文中一共展示了TreeMap.entrySet方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例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,代碼來源:DemoClient.java

示例3: assignLayers

import java.util.TreeMap; //導入方法依賴的package包/類
private ArrayList<ArrayList<mxCell>> assignLayers() {
  final TreeMap<Double, TreeMap<Double, mxCell>> layers = this.mapLayers();
  final ArrayList<ArrayList<mxCell>> listOfLayers = new ArrayList<>();

  int i = layers.entrySet().size() - 1;
  for (final Entry<Double, TreeMap<Double, mxCell>> entry : layers.entrySet()) {
    final TreeMap<Double, mxCell> layer = entry.getValue();
    final ArrayList<mxCell> layerCells = new ArrayList<>();
    int j = 0;
    for (final Entry<Double, mxCell> entry2 : layer.entrySet()) {
      if (entry2.getValue() instanceof mxCell) {
        final mxCell cell = entry2.getValue();
        ((ModelElement) cell.getValue()).setAttribute(GraphUtil.LAYER, String.valueOf(i));
        ((ModelElement) cell.getValue()).setAttribute(GraphUtil.ORDER, String.valueOf(j));
        layerCells.add(cell);
        j++;
      } else {
        layerCells.add(entry2.getValue());
      }
    }
    listOfLayers.add(layerCells);
    i--;
  }
  Collections.reverse(listOfLayers);
  return listOfLayers;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:27,代碼來源:GraphUtil.java

示例4: getRanges

import java.util.TreeMap; //導入方法依賴的package包/類
private MDRange[] getRanges(TreeMap<byte[], TreeSet<byte[]>> indexFamilyMap,
    ScanRange.ScanRangeList rangeList) {
  List<MDRange> mdRangeList = new ArrayList<>();
  for (Map.Entry<byte[], TreeSet<byte[]>> entry : indexFamilyMap.entrySet()) {
    for (byte[] qualifier : entry.getValue()) {
      boolean match = false;
      for (ScanRange range : rangeList.getRanges()) {
        if (Bytes.compareTo(entry.getKey(), range.getFamily()) == 0
            && Bytes.compareTo(qualifier, range.getQualifier()) == 0) {
          int min = (range.getStart() == null) ? 0 : Bytes.toInt(range.getStart());
          int max =
              range.getRawStop() == null ? Integer.MAX_VALUE : Bytes.toInt(range.getRawStop());
          mdRangeList.add(new MDRange(min, max));
          match = true;
        }
      }
      if (!match) {
        mdRangeList.add(new MDRange(0, Integer.MAX_VALUE));
      }
    }
  }
  return mdRangeList.toArray(new MDRange[mdRangeList.size()]);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:LMDIndexDirectStoreFileScanner.java

示例5: insert

import java.util.TreeMap; //導入方法依賴的package包/類
public void insert(List<MDPoint> points) throws IOException {
  TreeMap<byte[], List<MDPoint>> map = new TreeMap<>(Bytes.BYTES_COMPARATOR);
  for (MDPoint point : points) {
    byte[] row = MDUtils.bitwiseZip(point.values, dimensions);
    List<MDPoint> list = map.get(row);
    if (list == null) {
      list = new ArrayList<>();
      map.put(row, list);
    }
    list.add(point);
  }

  for (Map.Entry<byte[], List<MDPoint>> entry : map.entrySet()) {
    MDBucket bucket = index.fetchBucket(entry.getKey());
    bucket.insert(entry.getKey(), entry.getValue());
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:18,代碼來源:MDHBaseAdmin.java

示例6: inferBoundaries

import java.util.TreeMap; //導入方法依賴的package包/類
public static byte[][] inferBoundaries(TreeMap<byte[], Integer> bdryMap) {
  ArrayList<byte[]> keysArray = new ArrayList<byte[]>();
  int runningValue = 0;
  byte[] currStartKey = null;
  boolean firstBoundary = true;

  for (Map.Entry<byte[], Integer> item: bdryMap.entrySet()) {
    if (runningValue == 0) currStartKey = item.getKey();
    runningValue += item.getValue();
    if (runningValue == 0) {
      if (!firstBoundary) keysArray.add(currStartKey);
      firstBoundary = false;
    }
  }

  return keysArray.toArray(new byte[0][0]);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:18,代碼來源:LoadIncrementalHFiles.java

示例7: currentlog

import java.util.TreeMap; //導入方法依賴的package包/類
@RequestMapping(value = "/apistatisticday", method = RequestMethod.GET)
public String currentlog(Model model,
                         @RequestParam(value = "topdatarange", required = false, defaultValue = "0") String topdaterange,
                         @RequestParam(value = "url", required = false, defaultValue = "") String url
) {

    //date list
    List<String> timelist = DateTimeHelper.getDateTimeListForPage(fieryConfig.getKeepdataday());
    model.addAttribute("datelist", timelist);
    model.addAttribute("datelist_selected", topdaterange);

    model.addAttribute("url", url);

    //now the date render
    long shardtime = DateTimeHelper.getTimesMorning(DateTimeHelper.getBeforeDay(Integer.parseInt(topdaterange)));

    TreeMap<Long, APIStatisticStruct> urlList = apiStatisticTimeSet.getHourDetail(url, shardtime);

    //log.info("size:" + urlList.size());

    model.addAttribute("urllist", urlList);

    //http code
    TreeMap<String, Long> httpCodeMap = new TreeMap<>();
    for (Map.Entry<Long, APIStatisticStruct> timeItem : urlList.entrySet()) {
        for (ConcurrentHashMap.Entry<String, AtomicLong> httpitem : timeItem.getValue().getCode_count().entrySet()) {
            if (!httpCodeMap.containsKey(httpitem.getKey())) {
                httpCodeMap.put(httpitem.getKey(), httpitem.getValue().longValue());
            } else {
                httpCodeMap.put(httpitem.getKey(), httpCodeMap.get(httpitem.getKey()) + httpitem.getValue().longValue());
            }
        }

    }

    model.addAttribute("httpcode", httpCodeMap);

    return "apistatisticday";
}
 
開發者ID:weiboad,項目名稱:fiery,代碼行數:40,代碼來源:APIStatisticDayPage.java

示例8: getFileUploadProcessors

import java.util.TreeMap; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected List<FileUploadProcessor> getFileUploadProcessors(String group) throws Exception {
  // 初始化業務分支
  if (initdTag.compareAndSet(false, true)) {
    TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> all =
        (TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>>) fileProcessFactory.getObject();
    //
    TreeMap<Integer, LinkedList<FileUploadProcessor>> pd = all.get(AbstractChannelProcessor.KEY);
    for (Entry<Integer, LinkedList<FileUploadProcessor>> orderProcessorEntry : pd.entrySet()) {
      publicChannel.addAll(orderProcessorEntry.getValue());
    }
    all.remove(AbstractChannelProcessor.KEY);//幹掉主分支
    // 遍曆其他的樹
    for (Entry<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> tree : all.entrySet()) {
      TreeMap<Integer, LinkedList<FileUploadProcessor>> thisTree = tree.getValue();
      LinkedList<FileUploadProcessor> thisTreeList = new LinkedList<FileUploadProcessor>();
      // 添加樹枝
      for (Entry<Integer, LinkedList<FileUploadProcessor>> branch : thisTree.entrySet()) {
        thisTreeList.addAll(branch.getValue());
      }
      for (int i = 0; i < thisTreeList.size()-1; i++) {
        ((AbstractChannelProcessor)thisTreeList.get(i)).nextProcessor = thisTreeList.get(i+1);
      }
      namedChannel.put(tree.getKey(), thisTreeList);
    }
  }
  //
  if (StringUtils.isBlank(group)) {
    return publicChannel;
  } else {
    LinkedList<FileUploadProcessor> ppl = namedChannel.get(group);
    return ppl == null ? new LinkedList<FileUploadProcessor>() : ppl;
  }
}
 
開發者ID:devpage,項目名稱:fastdfs-quickstart,代碼行數:35,代碼來源:GenericFileProcessor.java

示例9: toString

import java.util.TreeMap; //導入方法依賴的package包/類
@Override
public String toString() {
  StringBuilder strBuilder = new StringBuilder();
  TreeMap<Integer, KafkaBroker> treeMap = new TreeMap(brokers);
  for (Map.Entry<Integer, KafkaBroker> entry : treeMap.entrySet()) {
    strBuilder.append("   " + entry.getKey() + " : ");
    strBuilder.append(entry.getValue() + "\n");
  }
  return strBuilder.toString();
}
 
開發者ID:pinterest,項目名稱:doctorkafka,代碼行數:11,代碼來源:KafkaCluster.java

示例10: createCanonicalParameterString

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * Use aws version 4 method to create the canonical parameter string
 * @param params
 * @return
 */
private String createCanonicalParameterString(HashMap<String, String> params) {
    String paramString = "";
    if (params != null && !params.isEmpty()) {
        TreeMap<String, String> sortedMap = new TreeMap<String, String>(params);
        for (Map.Entry<String, String> entry : sortedMap.entrySet()) {
            paramString = paramString + entry.getKey() + "=" + entry.getValue();
            if (!sortedMap.lastKey().equals(entry.getKey())) {
                paramString = paramString + "&";
            }
        }
    }
    return paramString;
}
 
開發者ID:boomiutils,項目名稱:api-aws-signature,代碼行數:19,代碼來源:AwsHelper.java

示例11: buildResource

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * 將path、queryParam、formParam合成一個字符串
 *
 */
private static String buildResource(String pathWithParams, Map<String, String> queryParams, Map<String, String> formParams) {
    StringBuilder result = new StringBuilder();
    result.append(pathWithParams);

    //使用TreeMap,默認按照字母排序
    TreeMap<String, String> parameter = new TreeMap<String, String>();
    if (MapUtils.isNotEmpty(queryParams)) {
        parameter.putAll(queryParams);
    }
    if (MapUtils.isNotEmpty(formParams)) {
        parameter.putAll(formParams);
    }

    if (parameter.size() > 0) {
        result.append("?");

        // bugfix by [email protected]: "kv separator should be ignored while value is empty, ex. k1=v1&k2&k3=v3&k4"
        List<String> comboMap = new ArrayList<String>();
        for(Entry<String, String> entry : parameter.entrySet()){
            String comboResult = entry.getKey() + (StringUtils.isNotEmpty(entry.getValue())? "="+entry.getValue() : StringUtils.EMPTY);
            comboMap.add(comboResult);
        }
        Joiner joiner = Joiner.on("&");
        result.append(joiner.join(comboMap));
    }
    return result.toString();
}
 
開發者ID:aliyun,項目名稱:apigateway-sdk-core,代碼行數:32,代碼來源:SignUtil.java

示例12: entrySet

import java.util.TreeMap; //導入方法依賴的package包/類
/**
 * Enables xml output sorted on entry key. This method should not be called directly, it is used
 * in {@link RsProperties#storeToXML(File, String)}.
 *
 * @return entrySet sorted on key values
 */
@Override
@Nonnull
public Set<Map.Entry<Object, Object>> entrySet() {
  TreeMap<Object, Object> tm = new TreeMap<>();
  for (Map.Entry<Object, Object> entry : super.entrySet()) {
    tm.put(entry.getKey(), entry.getValue());
  }
  return tm.entrySet();
}
 
開發者ID:EHRI,項目名稱:rs-aggregator,代碼行數:16,代碼來源:RsProperties.java

示例13: writeFamilyMap

import java.util.TreeMap; //導入方法依賴的package包/類
private void writeFamilyMap(TreeMap<byte[], TreeSet<byte[]>> map, DataOutput out)
    throws IOException {
  WritableUtils.writeVInt(out, map.size());
  for (Map.Entry<byte[], TreeSet<byte[]>> entry : map.entrySet()) {
    WritableUtils.writeCompressedByteArray(out, entry.getKey());
    WritableUtils.writeVInt(out, entry.getValue().size());
    for (byte[] b : entry.getValue()) {
      WritableUtils.writeCompressedByteArray(out, b);
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:12,代碼來源:IndexTableRelation.java

示例14: sign

import java.util.TreeMap; //導入方法依賴的package包/類
private String sign(String path, TreeMap<String, String> dynamicMap) {
    StringBuilder sb = new StringBuilder("POST");
    sb.append(path);
    for (Map.Entry<String, String> entry : dynamicMap.entrySet()) {
        sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
    }

    sb.append(AppConstant.APP_SECRET);
    HttpLog.i(sb.toString());
    return MD5.encode(sb.toString());
}
 
開發者ID:zhou-you,項目名稱:RxEasyHttp,代碼行數:12,代碼來源:TokenInterceptor.java

示例15: affixFST

import java.util.TreeMap; //導入方法依賴的package包/類
private FST<IntsRef> affixFST(TreeMap<String,List<Integer>> affixes) throws IOException {
  IntSequenceOutputs outputs = IntSequenceOutputs.getSingleton();
  Builder<IntsRef> builder = new Builder<>(FST.INPUT_TYPE.BYTE4, outputs);
  IntsRefBuilder scratch = new IntsRefBuilder();
  for (Map.Entry<String,List<Integer>> entry : affixes.entrySet()) {
    Util.toUTF32(entry.getKey(), scratch);
    List<Integer> entries = entry.getValue();
    IntsRef output = new IntsRef(entries.size());
    for (Integer c : entries) {
      output.ints[output.length++] = c;
    }
    builder.add(scratch.get(), output);
  }
  return builder.finish();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:Dictionary.java


注:本文中的java.util.TreeMap.entrySet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。