Java 类java.util.SortedMap 实例源码

项目:microbean-helm    文件:ChartRepository.java   
/**
 * Performs a deep copy of the supplied {@link Map} such that the
 * {@link SortedMap} returned has copies of the supplied {@link
 * Map}'s {@linkplain Map#values() values}.
 *
 * <p>This method may return {@code null} if {@code source} is
 * {@code null}.</p>
 *
 * <p>The {@link SortedMap} returned by this method is
 * mutable.</p>
 *
 * @param source the {@link Map} to copy; may be {@code null} in
 * which case {@code null} will be returned
 *
 * @return a mutable {@link SortedMap}, or {@code null}
 */
private static final SortedMap<String, SortedSet<Entry>> deepCopy(final Map<? extends String, ? extends SortedSet<Entry>> source) {
  final SortedMap<String, SortedSet<Entry>> returnValue;
  if (source == null) {
    returnValue = null;
  } else if (source.isEmpty()) {
    returnValue = Collections.emptySortedMap();
  } else {
    returnValue = new TreeMap<>();
    final Collection<? extends Map.Entry<? extends String, ? extends SortedSet<Entry>>> entrySet = source.entrySet();
    if (entrySet != null && !entrySet.isEmpty()) {
      for (final Map.Entry<? extends String, ? extends SortedSet<Entry>> entry : entrySet) {
        final String key = entry.getKey();
        final SortedSet<Entry> value = entry.getValue();
        if (value == null) {
          returnValue.put(key, null);
        } else {
          final SortedSet<Entry> newValue = new TreeSet<>(value.comparator());
          newValue.addAll(value);
          returnValue.put(key, newValue);
        }
      }
    }
  }
  return returnValue;
}
项目:sats-core    文件:MRVMNationalBidder.java   
private static ImmutableSortedMap<Integer, BigDecimal> buildGammaMap(Map<Integer, BigDecimal> gammaInput) {
    ImmutableSortedMap.Builder<Integer, BigDecimal> mapBuilder = ImmutableSortedMap.naturalOrder();
    SortedMap<Integer, BigDecimal> sortedInput = new TreeMap<>(gammaInput);
    Preconditions.checkArgument(sortedInput.firstKey() == 1,
            "Gamma Values must (exclusively) be specified for quantities 1 and (optionally) higher",
            sortedInput);
    Preconditions.checkArgument(sortedInput.lastKey().equals(sortedInput.size()), ""
                    + "Gamma Values must be specified for all capacities in {0, ..., k_{max}}, where k_{max} > 0 is any natural number > 0",
            sortedInput);

    for (Entry<Integer, BigDecimal> inputGammaEntry : sortedInput.entrySet()) {
        Preconditions.checkArgument(inputGammaEntry.getValue().compareTo(BigDecimal.ZERO) >= 0, "Gamma must not be negative", inputGammaEntry);
        mapBuilder.put(inputGammaEntry);
    }
    return mapBuilder.build();
}
项目:googles-monorepo-demo    文件:MapsTest.java   
public void testSortedMapDifferenceEquals() {
  SortedMap<Integer, String> left =
      ImmutableSortedMap.of(1, "a", 2, "b", 3, "c", 4, "d", 5, "e");
  SortedMap<Integer, String> right =
      ImmutableSortedMap.of(1, "a", 3, "f", 5, "g", 6, "z");
  SortedMap<Integer, String> right2 =
      ImmutableSortedMap.of(1, "a", 3, "h", 5, "g", 6, "z");
  SortedMapDifference<Integer, String> original =
      Maps.difference(left, right);
  SortedMapDifference<Integer, String> same =
      Maps.difference(left, right);
  SortedMapDifference<Integer, String> reverse =
      Maps.difference(right, left);
  SortedMapDifference<Integer, String> diff2 =
      Maps.difference(left, right2);

  new EqualsTester()
      .addEqualityGroup(original, same)
      .addEqualityGroup(reverse)
      .addEqualityGroup(diff2)
      .testEquals();
}
项目:pScrobbler    文件:Cache.java   
/**
 * Creates a unique entry name string for a request. It consists of the method name and all the parameter names
 * and values concatenated in alphabetical order. It is used to identify cache entries in the backend storage.
 * If <code>hashCacheEntryNames</code> is set to <code>true</code> this method will return a MD5 hash of
 * the generated name.
 *
 * @param method The request method
 * @param params The request parameters
 * @return a cache entry name
 */
public static String createCacheEntryName(String method, Map<String, String> params) {
    if (!(params instanceof SortedMap)) {
        params = new TreeMap<String, String>(params);
    }
    StringBuilder b = new StringBuilder(100);
    b.append(method.toLowerCase());
    b.append('.');
    for (Map.Entry<String, String> e : params.entrySet()) {
        b.append(e.getKey());
        b.append(e.getValue());
    }
    String name = b.toString();
    if (hashCacheEntryNames)
        return StringUtilities.md5(name);
    return StringUtilities.cleanUp(name);
}
项目:HCFCore    文件:DualTreeBidiMap.java   
@Override
public K nextKey(final K key) {
    if (isEmpty()) {
        return null;
    }
    if (normalMap instanceof OrderedMap) {
        return ((OrderedMap<K, ?>) normalMap).nextKey(key);
    }
    final SortedMap<K, V> sm = (SortedMap<K, V>) normalMap;
    final Iterator<K> it = sm.tailMap(key).keySet().iterator();
    it.next();
    if (it.hasNext()) {
        return it.next();
    }
    return null;
}
项目:incubator-netbeans    文件:MakeOSGiTest.java   
private void assertTranslation(String expectedOsgi, String netbeans, Set<String> importedPackages, Set<String> exportedPackages) throws Exception {
    assertTrue(netbeans.endsWith("\n")); // JRE bug
    Manifest nbmani = new Manifest(new ByteArrayInputStream(netbeans.getBytes()));
    Attributes nbattr = nbmani.getMainAttributes();
    Manifest osgimani = new Manifest();
    Attributes osgi = osgimani.getMainAttributes();
    Info info = new Info();
    info.importedPackages.addAll(importedPackages);
    info.exportedPackages.addAll(exportedPackages);
    new MakeOSGi().translate(nbattr, osgi, Collections.singletonMap(nbattr.getValue("OpenIDE-Module"), info));
    // boilerplate:
    assertEquals("1.0", osgi.remove(new Attributes.Name("Manifest-Version")));
    assertEquals("2", osgi.remove(new Attributes.Name("Bundle-ManifestVersion")));
    SortedMap<String,String> osgiMap = new TreeMap<>();
    for (Map.Entry<Object,Object> entry : osgi.entrySet()) {
        osgiMap.put(((Attributes.Name) entry.getKey()).toString(), (String) entry.getValue());
    }
    assertEquals(expectedOsgi, osgiMap.toString().replace('"', '\''));
}
项目:guava-mock    文件:ImmutableSortedMap.java   
/**
 * Returns an immutable map containing the same entries as the provided sorted
 * map, with the same ordering.
 *
 * <p>Despite the method name, this method attempts to avoid actually copying
 * the data when it is safe to do so. The exact circumstances under which a
 * copy will or will not be performed are undocumented and subject to change.
 *
 * @throws NullPointerException if any key or value in {@code map} is null
 */
@SuppressWarnings("unchecked")
public static <K, V> ImmutableSortedMap<K, V> copyOfSorted(SortedMap<K, ? extends V> map) {
  Comparator<? super K> comparator = map.comparator();
  if (comparator == null) {
    // If map has a null comparator, the keys should have a natural ordering,
    // even though K doesn't explicitly implement Comparable.
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  if (map instanceof ImmutableSortedMap) {
    // TODO(kevinb): Prove that this cast is safe, even though
    // Collections.unmodifiableSortedMap requires the same key type.
    @SuppressWarnings("unchecked")
    ImmutableSortedMap<K, V> kvMap = (ImmutableSortedMap<K, V>) map;
    if (!kvMap.isPartialView()) {
      return kvMap;
    }
  }
  return fromEntries(comparator, true, map.entrySet());
}
项目:googles-monorepo-demo    文件:TreeBasedTableTest.java   
public void testRowEntrySetContains() {
  table =
      sortedTable =
          create("a", 2, 'X', "a", 2, 'X', "b", 3, 'X', "b", 2, 'X', "c", 10,
              'X', "c", 10, 'X', "c", 20, 'X', "d", 15, 'X', "d", 20, 'X',
              "d", 1, 'X', "e", 5, 'X');
  SortedMap<Integer, Character> row = sortedTable.row("c");
  Set<Map.Entry<Integer, Character>> entrySet = row.entrySet();
  assertTrue(entrySet.contains(Maps.immutableEntry(10, 'X')));
  assertTrue(entrySet.contains(Maps.immutableEntry(20, 'X')));
  assertFalse(entrySet.contains(Maps.immutableEntry(15, 'X')));
  entrySet = row.tailMap(15).entrySet();
  assertFalse(entrySet.contains(Maps.immutableEntry(10, 'X')));
  assertTrue(entrySet.contains(Maps.immutableEntry(20, 'X')));
  assertFalse(entrySet.contains(Maps.immutableEntry(15, 'X')));
}
项目:googles-monorepo-demo    文件:SortedMapInterfaceTest.java   
public void testTailMapRemoveThrough() {
  final SortedMap<K, V> map;
  try {
    map = makePopulatedMap();
  } catch (UnsupportedOperationException e) {
    return;
  }
  int oldSize = map.size();
  if (map.size() < 2 || !supportsRemove) {
    return;
  }
  Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
  Entry<K, V> firstEntry = iterator.next();
  Entry<K, V> secondEntry = iterator.next();
  K key = secondEntry.getKey();
  SortedMap<K, V> subMap = map.tailMap(key);
  subMap.remove(key);
  assertNull(subMap.remove(firstEntry.getKey()));
  assertEquals(map.size(), oldSize - 1);
  assertFalse(map.containsKey(key));
  assertEquals(subMap.size(), oldSize - 2);
}
项目:googles-monorepo-demo    文件:TreeBasedTableTest.java   
public void testColumnComparator() {
  sortedTable = TreeBasedTable.create();
  sortedTable.put("", 42, 'x');
  assertSame(Ordering.natural(), sortedTable.columnComparator());
  assertSame(
      Ordering.natural(),
      ((SortedMap<Integer, Character>) sortedTable.rowMap().values().iterator().next())
          .comparator());

  sortedTable = TreeBasedTable.create(
      Collections.reverseOrder(), Ordering.usingToString());
  sortedTable.put("", 42, 'x');
  assertSame(Ordering.usingToString(), sortedTable.columnComparator());
  assertSame(
      Ordering.usingToString(),
      ((SortedMap<Integer, Character>) sortedTable.rowMap().values().iterator().next())
          .comparator());
}
项目:guava-mock    文件:MapsTest.java   
public void testAsMapSorted() {
  SortedSet<String> strings = new NonNavigableSortedSet();
  Collections.addAll(strings, "one", "two", "three");
  SortedMap<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION);
  assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map);
  assertEquals(Integer.valueOf(5), map.get("three"));
  assertNull(map.get("five"));
  assertThat(map.entrySet()).containsExactly(
      mapEntry("one", 3),
      mapEntry("three", 5),
      mapEntry("two", 3)).inOrder();
  assertThat(map.tailMap("onea").entrySet()).containsExactly(
      mapEntry("three", 5),
      mapEntry("two", 3)).inOrder();
  assertThat(map.subMap("one", "two").entrySet()).containsExactly(
      mapEntry("one", 3),
      mapEntry("three", 5)).inOrder();
}
项目:dropwizard-influxdb-reporter    文件:InfluxDbMeasurementReporter.java   
@Override
public void report(final SortedMap<String, Gauge> gauges,
                   final SortedMap<String, Counter> counters,
                   final SortedMap<String, Histogram> histograms,
                   final SortedMap<String, Meter> meters,
                   final SortedMap<String, Timer> timers) {
  final long timestamp = clock.instant().toEpochMilli();

  final ImmutableList<InfluxDbMeasurement> influxDbMeasurements = ImmutableList.<InfluxDbMeasurement>builder()
    .addAll(transformer.fromGauges(gauges, timestamp))
    .addAll(transformer.fromCounters(counters, timestamp))
    .addAll(transformer.fromHistograms(histograms, timestamp))
    .addAll(transformer.fromMeters(meters, timestamp))
    .addAll(transformer.fromTimers(timers, timestamp))
    .build();

  sender.send(influxDbMeasurements);
}
项目:hadoop    文件:CachedHistoryStorage.java   
@Override
public Map<JobId, Job> getAllPartialJobs() {
  LOG.debug("Called getAllPartialJobs()");
  SortedMap<JobId, Job> result = new TreeMap<JobId, Job>();
  try {
    for (HistoryFileInfo mi : hsManager.getAllFileInfo()) {
      if (mi != null) {
        JobId id = mi.getJobId();
        result.put(id, new PartialJob(mi.getJobIndexInfo(), id));
      }
    }
  } catch (IOException e) {
    LOG.warn("Error trying to scan for all FileInfos", e);
    throw new YarnRuntimeException(e);
  }
  return result;
}
项目:googles-monorepo-demo    文件:MinMaxPriorityQueueTest.java   
private static void removeMaxFromReplica(
    SortedMap<Integer, AtomicInteger> replica,
    int maxValue) {
  Integer replicatedMaxValue = replica.lastKey();
  assertTrue("maxValue is incorrect", replicatedMaxValue == maxValue);
  removeFromReplica(replica, replicatedMaxValue);
}
项目:q-mail    文件:ChooseFolder.java   
private SortedMap<String, SortedMap> buildHierarchy(String parentId, List<LocalFolder> folders) {
    SortedMap<String, SortedMap> folderStructure = new TreeMap<>();
    for (Folder folder: folders) {
        if (parentId.equals(folder.getParentId())) {
            folderStructure.put(folder.getId(), buildHierarchy(folder.getId(), folders));
        }
    }
    return folderStructure;
}
项目:q-mail    文件:ChooseFolder.java   
private void generateFolderPairs(List<FolderIdNamePair> folders, Map<String, String> folderNames,
        SortedMap<String, SortedMap> folderOrdering, int level) {
    for (Entry<String, SortedMap> entry : folderOrdering.entrySet()) {
        folders.add(new FolderIdNamePair(entry.getKey(), folderNames.get(entry.getKey()), level));
        //noinspection unchecked Recursive data structure, not possible.
        generateFolderPairs(folders, folderNames, (SortedMap<String, SortedMap>) entry.getValue(), level+1);
    }
}
项目:guava-mock    文件:AbstractMapBasedMultimap.java   
@Override
Map<K, Collection<V>> createAsMap() {
  if (map instanceof NavigableMap) {
    return new NavigableAsMap((NavigableMap<K, Collection<V>>) map);
  } else if (map instanceof SortedMap) {
    return new SortedAsMap((SortedMap<K, Collection<V>>) map);
  } else {
    return new AsMap(map);
  }
}
项目:PACE    文件:VersioningIT.java   
/**
 * Run a specific test for a given version and configuration.
 *
 * @param dataScanner
 *          Scanner for the unsigned data.
 * @param encryptedScanner
 *          Scanner for the encryption data.
 * @param decryptor
 *          Decryptor for the data.
 */
private void runTest(Scanner dataScanner, Scanner encryptedScanner, EntryEncryptor decryptor) {
  // Read the encrypted data into memory.
  SortedMap<Key,Value> decryptedData = new TreeMap<>();
  for (Entry<Key,Value> encryptedEntry : encryptedScanner) {
    Entry<Key,Value> decryptedEntry = decryptor.decrypt(encryptedEntry);
    decryptedData.put(decryptedEntry.getKey(), decryptedEntry.getValue());
  }

  for (Entry<Key,Value> entry : dataScanner) {
    assertThat("there is a matching decrypted value", decryptedData.containsKey(entry.getKey()), is(true));
    assertThat("the value also matches", decryptedData.get(entry.getKey()).get(), equalTo(entry.getValue().get()));
  }
}
项目:jdk8u-jdk    文件:DataTransferer.java   
/**
 * Returns a Map whose keys are all of the possible formats into which the
 * Transferable's transfer data flavors can be translated. The value of
 * each key is the DataFlavor in which the Transferable's data should be
 * requested when converting to the format.
 * <p>
 * The map keys are sorted according to the native formats preference
 * order.
 */
public SortedMap<Long,DataFlavor> getFormatsForTransferable(
                           Transferable contents, FlavorTable map)
{
    DataFlavor[] flavors = contents.getTransferDataFlavors();
    if (flavors == null) {
        return new TreeMap();
    }
    return getFormatsForFlavors(flavors, map);
}
项目:s-store    文件:Maps.java   
/**
 * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when
 * filtering a filtered sorted map.
 */
private static <K, V> SortedMap<K, V> filterFiltered(
    FilteredEntrySortedMap<K, V> map,
    Predicate<? super Entry<K, V>> entryPredicate) {
  Predicate<Entry<K, V>> predicate
      = Predicates.and(map.predicate, entryPredicate);
  return new FilteredEntrySortedMap<K, V>(map.sortedMap(), predicate);
}
项目:googles-monorepo-demo    文件:SortedMapGenerators.java   
@Override
public SortedMap<String, String> create(Entry<String, String>[] entries) {
  ImmutableSortedMap.Builder<String, String> builder = ImmutableSortedMap.naturalOrder();
  for (Entry<String, String> entry : entries) {
    checkNotNull(entry);
    builder.put(entry.getKey(), entry.getValue());
  }
  return builder.build();
}
项目:webtrekk-android-sdk    文件:TrackingConfiguration.java   
private void checkParametersArrayForAutoTrackOverride(SortedMap<String, String> array, TrackingParameter.Parameter parType)
{
    if (array == null)
        return;

    for (String key: array.keySet())
    {
        AutoTrackedParameters autoTrackedParameter = isInAutoParameterList(parType, key);
        if (autoTrackedParameter != null && parameterAutoTrackedStatus(autoTrackedParameter) && autoTrackedParameter.getParType() == parType)
        {
            WebtrekkLogging.log("Warning: auto parameter " +autoTrackedParameter.name()+ " will be overwritten. If you don't want it, remove "+
                    parType.name()+" custom parameter number"+autoTrackedParameter.getValue()+ " definition");
        }
    }
}
项目:elasticsearch_my    文件:MetaData.java   
@SuppressWarnings("unchecked")
MetaData(String clusterUUID, long version, Settings transientSettings, Settings persistentSettings,
         ImmutableOpenMap<String, IndexMetaData> indices, ImmutableOpenMap<String, IndexTemplateMetaData> templates,
         ImmutableOpenMap<String, Custom> customs, String[] allIndices, String[] allOpenIndices, String[] allClosedIndices,
         SortedMap<String, AliasOrIndex> aliasAndIndexLookup) {
    this.clusterUUID = clusterUUID;
    this.version = version;
    this.transientSettings = transientSettings;
    this.persistentSettings = persistentSettings;
    this.settings = Settings.builder().put(persistentSettings).put(transientSettings).build();
    this.indices = indices;
    this.customs = customs;
    this.templates = templates;
    int totalNumberOfShards = 0;
    int numberOfShards = 0;
    for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
        totalNumberOfShards += cursor.value.getTotalNumberOfShards();
        numberOfShards += cursor.value.getNumberOfShards();
    }
    this.totalNumberOfShards = totalNumberOfShards;
    this.numberOfShards = numberOfShards;

    this.allIndices = allIndices;
    this.allOpenIndices = allOpenIndices;
    this.allClosedIndices = allClosedIndices;
    this.aliasAndIndexLookup = aliasAndIndexLookup;
}
项目:gemini.blueprint    文件:BlueprintEditorRegistrar.java   
public void registerCustomEditors(PropertyEditorRegistry registry) {
    // Date
    registry.registerCustomEditor(Date.class, new DateEditor());
    // Collection concrete types
    registry.registerCustomEditor(Stack.class, new BlueprintCustomCollectionEditor(Stack.class));
    registry.registerCustomEditor(Vector.class, new BlueprintCustomCollectionEditor(Vector.class));

    // Spring creates a LinkedHashSet for Collection, RFC mandates an ArrayList
    // reinitialize default editors
    registry.registerCustomEditor(Collection.class, new BlueprintCustomCollectionEditor(Collection.class));
    registry.registerCustomEditor(Set.class, new BlueprintCustomCollectionEditor(Set.class));
    registry.registerCustomEditor(SortedSet.class, new BlueprintCustomCollectionEditor(SortedSet.class));
    registry.registerCustomEditor(List.class, new BlueprintCustomCollectionEditor(List.class));
    registry.registerCustomEditor(SortedMap.class, new CustomMapEditor(SortedMap.class));

    registry.registerCustomEditor(HashSet.class, new BlueprintCustomCollectionEditor(HashSet.class));
    registry.registerCustomEditor(LinkedHashSet.class, new BlueprintCustomCollectionEditor(LinkedHashSet.class));
    registry.registerCustomEditor(TreeSet.class, new BlueprintCustomCollectionEditor(TreeSet.class));

    registry.registerCustomEditor(ArrayList.class, new BlueprintCustomCollectionEditor(ArrayList.class));
    registry.registerCustomEditor(LinkedList.class, new BlueprintCustomCollectionEditor(LinkedList.class));

    // Map concrete types
    registry.registerCustomEditor(HashMap.class, new CustomMapEditor(HashMap.class));
    registry.registerCustomEditor(LinkedHashMap.class, new CustomMapEditor(LinkedHashMap.class));
    registry.registerCustomEditor(Hashtable.class, new CustomMapEditor(Hashtable.class));
    registry.registerCustomEditor(TreeMap.class, new CustomMapEditor(TreeMap.class));
    registry.registerCustomEditor(Properties.class, new PropertiesEditor());

    // JDK 5 types
    registry.registerCustomEditor(ConcurrentMap.class, new CustomMapEditor(ConcurrentHashMap.class));
    registry.registerCustomEditor(ConcurrentHashMap.class, new CustomMapEditor(ConcurrentHashMap.class));
    registry.registerCustomEditor(Queue.class, new BlueprintCustomCollectionEditor(LinkedList.class));

    // Legacy types
    registry.registerCustomEditor(Dictionary.class, new CustomMapEditor(Hashtable.class));
}
项目:guava-mock    文件:ForwardingSortedMapImplementsMapTest.java   
@Override protected SortedMap<String, Integer> makePopulatedMap() {
  final SortedMap<String, Integer> sortedMap = makeEmptyMap();
  sortedMap.put("one", 1);
  sortedMap.put("two", 2);
  sortedMap.put("three", 3);
  return sortedMap;
}
项目:guava-mock    文件:MapsTest.java   
public void testAsMapSortedWritesThrough() {
  SortedSet<String> strings = new NonNavigableSortedSet();
  Collections.addAll(strings, "one", "two", "three");
  SortedMap<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION);
  assertEquals(ImmutableMap.of("one", 3, "two", 3, "three", 5), map);
  assertEquals(Integer.valueOf(3), map.remove("two"));
  assertThat(strings).containsExactly("one", "three").inOrder();
}
项目:incubator-netbeans    文件:AnnotationViewDataImpl.java   
synchronized SortedMap<Integer, List<Mark>> getMarkMap() {
    if (marksMap == null) {
        Collection<Mark> marks = getMergedMarks();
        marksMap = new TreeMap<Integer, List<Mark>>();

        for (Mark mark : marks) {
            registerMark(mark);
        }
    }

    return marksMap;
}
项目:goobi-viewer-indexer    文件:RemainingSpaceStrategyTest.java   
/**
 * @see RemainingSpaceStrategy#selectRepository(SortedMap,long)
 * @verifies return null if recordSize is larger than any available repository space
 */
@Test
public void selectRepository_shouldReturnNullIfRecordSizeIsLargerThanAnyAvailableRepositorySpace() throws Exception {
    SortedMap<Long, DataRepository> repositorySpaceMap = new TreeMap<>();
    repositorySpaceMap.put(30L, new DataRepository("/opt/digiverso/viewer/data/3", true));
    repositorySpaceMap.put(20L, new DataRepository("/opt/digiverso/viewer/data/2", true));
    repositorySpaceMap.put(10L, new DataRepository("/opt/digiverso/viewer/data/1", true));
    Assert.assertEquals(null, RemainingSpaceStrategy.selectRepository(repositorySpaceMap, 33L));
}
项目:OpenJSharp    文件:PropMap.java   
SortedMap<String, String> prefixMap(String prefix) {
    int len = prefix.length();
    if (len == 0)
        return this;
    char nextch = (char)(prefix.charAt(len-1) + 1);
    String limit = prefix.substring(0, len-1)+nextch;
    //System.out.println(prefix+" => "+subMap(prefix, limit));
    return subMap(prefix, limit);
}
项目:ApkMultiChannelPlugin    文件:ManifestWriter.java   
static void writeAttributes(
        OutputStream out, SortedMap<String, String> attributesSortedByName) throws IOException {
    for (Map.Entry<String, String> attribute : attributesSortedByName.entrySet()) {
        String attrName = attribute.getKey();
        String attrValue = attribute.getValue();
        writeAttribute(out, attrName, attrValue);
    }
}
项目:webtrekk-android-sdk    文件:TrackingRequest.java   
/**
 * this method is generated p parameter for URL for specific implementation
 * @param trackingParameter
 * @return
 */
@Override
public String getPValue(TrackingParameter trackingParameter) {
    SortedMap<Parameter, String> tp = trackingParameter.getDefaultParameter();

    return "p=" + Webtrekk.mTrackingLibraryVersion + ",0";
}
项目:monarch    文件:RowTupleConcurrentSkipListMap.java   
private static SortedMap<Object, Object> getMap(final int mapType) {
  final SortedMap<Object, Object> sm;
  switch (mapType) {
    case 0:
      logger.info("Using: Object2ObjectAVLTreeMap");
      sm = Object2ObjectSortedMaps.synchronize(new Object2ObjectAVLTreeMap<>());
      break;
    default:
      logger.info("Using: ConcurrentSkipListMap");
      sm = new ConcurrentSkipListMap<>();
      break;
  }
  return sm;
}
项目:guava-mock    文件:MapsTest.java   
public void testSortedMapTransformValues() {
  SortedMap<String, Integer> map =
      sortedNotNavigable(ImmutableSortedMap.of("a", 4, "b", 9));
  SortedMap<String, Double> transformed =
      transformValues(map, SQRT_FUNCTION);

  /*
   * We'd like to sanity check that we didn't get a NavigableMap out, but we
   * can't easily do so while maintaining GWT compatibility.
   */
  assertEquals(ImmutableSortedMap.of("a", 2.0, "b", 3.0), transformed);
}
项目:lams    文件:ResourceOutputFactory.java   
/**
    * Follows {@link PixlrService#getToolOutput(List, Long, Long)}.
    *
    */
   public SortedMap<String, ToolOutput> getToolOutput(List<String> names, IResourceService resourceService,
    Long toolSessionId, Long learnerId) {

TreeMap<String, ToolOutput> outputs = new TreeMap<String, ToolOutput>();
// tool output cache
TreeMap<String, ToolOutput> baseOutputs = new TreeMap<String, ToolOutput>();
if (names == null) {
    outputs.put(ResourceConstants.SHARED_ITEMS_DEFINITION_NAME, getToolOutput(
        ResourceConstants.SHARED_ITEMS_DEFINITION_NAME, resourceService, toolSessionId, learnerId));
} else {
    for (String name : names) {
    String[] nameParts = splitConditionName(name);
    if (baseOutputs.get(nameParts[0]) != null) {
        outputs.put(name, baseOutputs.get(nameParts[0]));
    } else {
        ToolOutput output = getToolOutput(name, resourceService, toolSessionId, learnerId);
        if (output != null) {
        outputs.put(name, output);
        baseOutputs.put(nameParts[0], output);
        }
    }
    }
}

return outputs;

   }
项目:googles-monorepo-demo    文件:TreeBasedTable.java   
@Override
SortedMap<C, V> computeBackingRowMap() {
  SortedMap<C, V> map = wholeRow();
  if (map != null) {
    if (lowerBound != null) {
      map = map.tailMap(lowerBound);
    }
    if (upperBound != null) {
      map = map.headMap(upperBound);
    }
    return map;
  }
  return null;
}
项目:lams    文件:LearningAction.java   
private ActionForward retake(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {
AnswerForm answerForm = (AnswerForm) form;
Integer questionSeqID = answerForm.getQuestionSeqID();

String sessionMapID = answerForm.getSessionMapID();
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
    .getAttribute(sessionMapID);

SortedMap<Integer, AnswerDTO> surveyItemMap = getQuestionList(sessionMap);
Collection<AnswerDTO> surveyItemList = surveyItemMap.values();

if ( surveyItemList.size() < 2 || ( questionSeqID != null && questionSeqID > 0 ) ) {
    answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE);
} else {
    answerForm.setPosition(SurveyConstants.POSITION_FIRST);
}
if ( questionSeqID == null || questionSeqID <= 0 ) {
    Boolean onePage = (Boolean) sessionMap.get(SurveyConstants.ATTR_SHOW_ON_ONE_PAGE);
    if ( ! onePage && surveyItemList.size() > 0) {
    answerForm.setQuestionSeqID(surveyItemMap.firstKey());
    questionSeqID = surveyItemMap.firstKey();
    }
}

// get current question index of total questions
int currIdx = new ArrayList<Integer>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1;
answerForm.setCurrentIdx(currIdx);

return mapping.findForward(SurveyConstants.SUCCESS);
   }
项目:Lagerta    文件:AdvancedReporter.java   
protected abstract void reportStatistics(
    SortedMap<String, Gauge> gauges,
    SortedMap<String, Counter> counters,
    SortedMap<String, Histogram> histograms,
    SortedMap<String, Meter> meters,
    SortedMap<String, Timer> timers
);
项目:metanome-algorithms    文件:HyperLogLogPlus.java   
private static double getEstimateBias(double estimate, int p) {
  // get nearest neighbors for this estimate and precision
  // above p = 18 there is no bias correction
  if (p > 18) {
    return 0;
  }
  double[] estimateVector = rawEstimateData[p - 4];
  SortedMap<Double, Integer> estimateDistances = calcDistances(estimate, estimateVector);
  int[] nearestNeighbors = getNearestNeighbors(estimateDistances);
  return getBias(nearestNeighbors, p);
}
项目:googles-monorepo-demo    文件:SortedMapInterfaceTest.java   
@Override
protected SortedMap<K, V> makeEitherMap() {
  try {
    return makePopulatedMap();
  } catch (UnsupportedOperationException e) {
    return makeEmptyMap();
  }
}
项目:pzubaha    文件:StAXParser.java   
/**
 * Main method for the program.
 * @param args args.
 * @throws FileNotFoundException if file not found.
 * @throws XMLStreamException unexpected
 * processing conditions.
 */
public static void main(String[] args) throws FileNotFoundException, XMLStreamException {
    StAXParser parser = new StAXParser();
    long start = System.currentTimeMillis();
    SortedMap<String, OrderBook> map = parser.parse(new FileInputStream("C:\\projects\\orders.xml"));
    StringBuilder builder = new StringBuilder();
    for (OrderBook ob : map.values()) {
        builder.append(ob.print());
    }
    System.out.println(builder);
    System.out.println(System.currentTimeMillis() - start);
}