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


Java NavigableMap.entrySet方法代码示例

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


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

示例1: handleQueryResult

import java.util.NavigableMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List<Map<String, String>> handleQueryResult(Object result, DataStoreMsg msg,
        DataStoreConnection connection) {

    List<Map<String, String>> list = new ArrayList<Map<String, String>>();
    Map<String, String> map = null;
    for (NavigableMap<byte[], byte[]> entrys : (List<NavigableMap<byte[], byte[]>>) result) {
        map = new HashMap<String, String>();
        for (Entry<byte[], byte[]> entry : entrys.entrySet()) {
            map.put(new String(entry.getKey()), new String(entry.getValue()));
        }
        list.add(map);
    }
    return list;
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:17,代码来源:LogDataAdapter.java

示例2: testEntrySet

import java.util.NavigableMap; //导入方法依赖的package包/类
/**
 * entrySet contains all pairs
 */
public void testEntrySet() {
    NavigableMap map = map5();
    Set s = map.entrySet();
    assertEquals(5, s.size());
    Iterator it = s.iterator();
    while (it.hasNext()) {
        Map.Entry e = (Map.Entry) it.next();
        assertTrue(
                   (e.getKey().equals(one) && e.getValue().equals("A")) ||
                   (e.getKey().equals(two) && e.getValue().equals("B")) ||
                   (e.getKey().equals(three) && e.getValue().equals("C")) ||
                   (e.getKey().equals(four) && e.getValue().equals("D")) ||
                   (e.getKey().equals(five) && e.getValue().equals("E")));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:TreeSubMapTest.java

示例3: testDescendingEntrySet

import java.util.NavigableMap; //导入方法依赖的package包/类
/**
 * entrySet contains all pairs
 */
public void testDescendingEntrySet() {
    NavigableMap map = dmap5();
    Set s = map.entrySet();
    assertEquals(5, s.size());
    Iterator it = s.iterator();
    while (it.hasNext()) {
        Map.Entry e = (Map.Entry) it.next();
        assertTrue(
                   (e.getKey().equals(m1) && e.getValue().equals("A")) ||
                   (e.getKey().equals(m2) && e.getValue().equals("B")) ||
                   (e.getKey().equals(m3) && e.getValue().equals("C")) ||
                   (e.getKey().equals(m4) && e.getValue().equals("D")) ||
                   (e.getKey().equals(m5) && e.getValue().equals("E")));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:TreeSubMapTest.java

示例4: mapRow

import java.util.NavigableMap; //导入方法依赖的package包/类
@Override
public TraceAnnotationDto mapRow(Result res, int rowNum) throws Exception {
    String rowKey = new String(res.getRow());
    NavigableMap<byte[], byte[]> familyMap = res.getFamilyMap(TABLE_ANNOTATION_COLUMN_FAMILY.getBytes());


    String[] ss = rowKey.split("_");
    String iface = ss[0];
    String method = ss[1];
    String type = ss[2];
    long timestamp = Long.parseLong(ss[3]);

    String traceId = "", value = "";
    for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
        traceId = new String(entry.getKey());
        value = new String(entry.getValue());
    }

    TraceAnnotationDto tad = new TraceAnnotationDto();
    tad.setRowKey(rowKey).setIface(iface).setMethod(method).setType(type).setTimestamp(timestamp);
    tad.setTraceId(traceId).setValue(value);
    return tad;
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:24,代码来源:TraceAnnotationDto.java

示例5: mapRow

import java.util.NavigableMap; //导入方法依赖的package包/类
@Override
public TraceDto mapRow(Result res, int rowNum) throws Exception {

    String traceId = new String(res.getRow());
    NavigableMap<byte[], byte[]> data = res.getFamilyMap(Constants.TABLE_TRACE_COLUMN_FAMILY.getBytes());

    String spanId;
    JSONObject spanDetail;
    TreeMap<String, JSONObject> map = new TreeMap<>();
    Set<Map.Entry<byte[], byte[]>> spanEntrySet = data.entrySet();
    for (Map.Entry<byte[], byte[]> entry : spanEntrySet) {
        spanId = new String(entry.getKey());
        spanDetail = JSON.parseObject(new String(entry.getValue()));
        map.put(spanId, spanDetail);
    }
    Set<Map.Entry<String, JSONObject>> spans = map.entrySet();


    TraceDto rtn = new TraceDto();
    rtn.setTraceId(traceId).setSpans(spans);
    return rtn;
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:23,代码来源:TraceDto.java

示例6: getFamilyMap

import java.util.NavigableMap; //导入方法依赖的package包/类
/**
 * Map of qualifiers to values.
 * <p>
 * Returns a Map of the form: <code>Map&lt;qualifier,value&gt;</code>
 * @param family column family to get
 * @return map of qualifiers to values
 */
public NavigableMap<byte[], byte[]> getFamilyMap(byte [] family) {
  if(this.familyMap == null) {
    getMap();
  }
  if(isEmpty()) {
    return null;
  }
  NavigableMap<byte[], byte[]> returnMap =
    new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
  NavigableMap<byte[], NavigableMap<Long, byte[]>> qualifierMap =
    familyMap.get(family);
  if(qualifierMap == null) {
    return returnMap;
  }
  for(Map.Entry<byte[], NavigableMap<Long, byte[]>> entry :
    qualifierMap.entrySet()) {
    byte [] value =
      entry.getValue().get(entry.getValue().firstKey());
    returnMap.put(entry.getKey(), value);
  }
  return returnMap;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:Result.java

示例7: asMap

import java.util.NavigableMap; //导入方法依赖的package包/类
@Override
public NavigableMap<String, T> asMap() {
    NavigableMap<String, ? super T> delegateMap = delegate.asMap();

    NavigableMap<String, T> filtered = new TreeMap<String, T>();
    for (Map.Entry<String, ? super T> entry : delegateMap.entrySet()) {
        T obj = filter.filter(entry.getValue());
        if (obj != null) {
            filtered.put(entry.getKey(), obj);
        }
    }

    return filtered;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:DefaultNamedDomainObjectCollection.java

示例8: scan

import java.util.NavigableMap; //导入方法依赖的package包/类
public void scan(Connection connection, TableName tableName) throws IOException {
    Table table = null;
    try {
        table = connection.getTable(tableName);
        ResultScanner rs = null;
        try {
            //Scan scan = new Scan(Bytes.toBytes("u120000"), Bytes.toBytes("u200000"));
            rs = table.getScanner(new Scan());
            for(Result r:rs){
                NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> navigableMap = r.getMap();
                for(Map.Entry<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> entry : navigableMap.entrySet()){
                    logger.info("row:{} key:{}", Bytes.toString(r.getRow()), Bytes.toString(entry.getKey()));
                    NavigableMap<byte[], NavigableMap<Long, byte[]>> map =entry.getValue();
                    for(Map.Entry<byte[], NavigableMap<Long, byte[]>> en:map.entrySet()){
                        System.out.print(Bytes.toString(en.getKey())+"##");
                        NavigableMap<Long, byte[]> ma = en.getValue();
                        for(Map.Entry<Long, byte[]>e: ma.entrySet()){
                            System.out.print(e.getKey()+"###");
                            System.out.println(Bytes.toString(e.getValue()));
                        }
                    }
                }
            }
        } finally {
            if(rs!=null) {
                rs.close();
            }
        }
    } finally {
        if(table!=null) {
            table.close();
        }
    }
}
 
开发者ID:TFdream,项目名称:hbase-tutorials,代码行数:35,代码来源:HBaseCrudDemo.java

示例9: onAfterCoalesce

import java.util.NavigableMap; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void onAfterCoalesce(Iterable<Increment> increments) {
  for (Increment inc : increments) {
    byte[] row = inc.getRow();
    Map<byte[], NavigableMap<byte[], Long>> families = null;
    try {
      families = (Map<byte[], NavigableMap<byte[], Long>>)
          refGetFamilyMap.invoke(inc);
    } catch (Exception e) {
      Throwables.propagate(e);
    }
    for (byte[] family : families.keySet()) {
      NavigableMap<byte[], Long> qualifiers = families.get(family);
      for (Map.Entry<byte[], Long> entry : qualifiers.entrySet()) {
        byte[] qualifier = entry.getKey();
        Long count = entry.getValue();
        StringBuilder b = new StringBuilder(20);
        b.append(new String(row, Charsets.UTF_8));
        b.append(':');
        b.append(new String(qualifier, Charsets.UTF_8));
        String key = b.toString();
        Assert.assertEquals("Expected counts don't match observed for " + key,
            expectedCounts.get(key), count);
      }
    }
  }
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:29,代码来源:TestHBaseSink.java

示例10: init

import java.util.NavigableMap; //导入方法依赖的package包/类
private void init() {
  logger.debug("Getting region locations");
  try {
    HTable table = new HTable(storagePluginConfig.getHBaseConf(), hbaseScanSpec.getTableName());
    this.hTableDesc = table.getTableDescriptor();
    NavigableMap<HRegionInfo, ServerName> regionsMap = table.getRegionLocations();
    statsCalculator = new TableStatsCalculator(table, hbaseScanSpec, storagePlugin.getContext().getConfig(), storagePluginConfig);

    boolean foundStartRegion = false;
    regionsToScan = new TreeMap<HRegionInfo, ServerName>();
    for (Entry<HRegionInfo, ServerName> mapEntry : regionsMap.entrySet()) {
      HRegionInfo regionInfo = mapEntry.getKey();
      if (!foundStartRegion && hbaseScanSpec.getStartRow() != null && hbaseScanSpec.getStartRow().length != 0 && !regionInfo.containsRow(hbaseScanSpec.getStartRow())) {
        continue;
      }
      foundStartRegion = true;
      regionsToScan.put(regionInfo, mapEntry.getValue());
      scanSizeInBytes += statsCalculator.getRegionSizeInBytes(regionInfo.getRegionName());
      if (hbaseScanSpec.getStopRow() != null && hbaseScanSpec.getStopRow().length != 0 && regionInfo.containsRow(hbaseScanSpec.getStopRow())) {
        break;
      }
    }

    table.close();
  } catch (IOException e) {
    throw new DrillRuntimeException("Error getting region info for table: " + hbaseScanSpec.getTableName(), e);
  }
  verifyColumns();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:30,代码来源:HBaseGroupScan.java

示例11: determineFirstPlayer

import java.util.NavigableMap; //导入方法依赖的package包/类
/**
 * Determines the player who should be play first, according to the Scrabble rules
 *
 * @param bag     The bag of the Scrabble game
 * @param players The players of the Scrabble game
 *
 * @return the player who should play first
 * @throws EmptyBagException if the bag is empty
 */
protected PlayerInterface determineFirstPlayer(BagInterface bag, List<PlayerInterface> players) throws EmptyBagException {
    NavigableMap<LetterInterface, PlayerInterface> playersDrawing = new TreeMap<>((o1, o2) -> o1.toString().compareTo(o2.toString()));

    for (PlayerInterface player : players) {
        playersDrawing.put(bag.drawLetter(), player);
    }

    for (NavigableMap.Entry<LetterInterface, PlayerInterface> playerDrawing : playersDrawing.entrySet()) {
        bag.putBackLetter(playerDrawing.getKey());
    }

    return playersDrawing.firstEntry().getValue();
}
 
开发者ID:Chrisp1tv,项目名称:ScrabbleGame,代码行数:23,代码来源:Scrabble.java

示例12: testClientPoolRoundRobin

import java.util.NavigableMap; //导入方法依赖的package包/类
@Test
public void testClientPoolRoundRobin() throws IOException {
  final TableName tableName = TableName.valueOf("testClientPoolRoundRobin");

  int poolSize = 3;
  int numVersions = poolSize * 2;
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set(HConstants.HBASE_CLIENT_IPC_POOL_TYPE, "round-robin");
  conf.setInt(HConstants.HBASE_CLIENT_IPC_POOL_SIZE, poolSize);

  Table table = TEST_UTIL.createTable(tableName, new byte[][] { FAMILY }, conf, Integer.MAX_VALUE);

  final long ts = EnvironmentEdgeManager.currentTime();
  Get get = new Get(ROW);
  get.addColumn(FAMILY, QUALIFIER);
  get.setMaxVersions();

  for (int versions = 1; versions <= numVersions; versions++) {
    Put put = new Put(ROW);
    put.add(FAMILY, QUALIFIER, ts + versions, VALUE);
    table.put(put);

    Result result = table.get(get);
    NavigableMap<Long, byte[]> navigableMap = result.getMap().get(FAMILY)
        .get(QUALIFIER);

    assertEquals("The number of versions of '" + FAMILY + ":" + QUALIFIER
        + " did not match " + versions, versions, navigableMap.size());
    for (Map.Entry<Long, byte[]> entry : navigableMap.entrySet()) {
      assertTrue("The value at time " + entry.getKey()
          + " did not match what was put",
          Bytes.equals(VALUE, entry.getValue()));
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:TestFromClientSide.java

示例13: assertAllOnLine

import java.util.NavigableMap; //导入方法依赖的package包/类
private void assertAllOnLine(final HTable t) throws IOException {
  NavigableMap<HRegionInfo, ServerName> regions = t.getRegionLocations();
  for (Map.Entry<HRegionInfo, ServerName> e: regions.entrySet()) {
    byte [] startkey = e.getKey().getStartKey();
    Scan s = new Scan(startkey);
    ResultScanner scanner = t.getScanner(s);
    Result r = scanner.next();
    org.junit.Assert.assertTrue(r != null && r.size() > 0);
    scanner.close();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:TestLoadAndSwitchEncodeOnDisk.java

示例14: transformResultAndAddToList

import java.util.NavigableMap; //导入方法依赖的package包/类
private void transformResultAndAddToList(Result result, List<MDPoint> found) {
  NavigableMap<byte[], byte[]> map = result.getFamilyMap(MDHBaseAdmin.SECONDARY_FAMILY);
  if (map == null) return;
  for (Entry<byte[], byte[]> entry : map.entrySet()) {
    MDPoint p = toPoint(entry.getKey(), entry.getValue());
    found.add(p);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:MDBucket.java

示例15: getAllRegionLocations

import java.util.NavigableMap; //导入方法依赖的package包/类
@Override
public List<HRegionLocation> getAllRegionLocations() throws IOException {
  NavigableMap<HRegionInfo, ServerName> locations =
      MetaScanner.allTableRegions(this.connection, getName());
  ArrayList<HRegionLocation> regions = new ArrayList<>(locations.size());
  for (Entry<HRegionInfo, ServerName> entry : locations.entrySet()) {
    regions.add(new HRegionLocation(entry.getKey(), entry.getValue()));
  }
  return regions;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:HRegionLocator.java


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