本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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()]);
}
示例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());
}
}
示例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]);
}
示例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";
}
示例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;
}
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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);
}
}
}
示例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());
}
示例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();
}