本文整理了Java中java.util.TreeMap.descendingKeySet()
方法的一些代码示例,展示了TreeMap.descendingKeySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeMap.descendingKeySet()
方法的具体详情如下:
包路径:java.util.TreeMap
类名称:TreeMap
方法名:descendingKeySet
暂无
代码示例来源:origin: apache/hbase
/**
* Sort history list by start time in descending order.
* @param historyList history list
* @return sorted list of BackupCompleteData
*/
public static ArrayList<BackupInfo> sortHistoryListDesc(ArrayList<BackupInfo> historyList) {
ArrayList<BackupInfo> list = new ArrayList<>();
TreeMap<String, BackupInfo> map = new TreeMap<>();
for (BackupInfo h : historyList) {
map.put(Long.toString(h.getStartTs()), h);
}
Iterator<String> i = map.descendingKeySet().iterator();
while (i.hasNext()) {
list.add(map.get(i.next()));
}
return list;
}
代码示例来源:origin: apache/incubator-druid
private void remove(
NavigableMap<Interval, TimelineEntry> timeline,
Interval interval,
boolean incompleteOk
)
{
timeline.remove(interval);
for (Map.Entry<Interval, TreeMap<VersionType, TimelineEntry>> versionEntry : allTimelineEntries.entrySet()) {
if (versionEntry.getKey().overlap(interval) != null) {
if (incompleteOk) {
add(timeline, versionEntry.getKey(), versionEntry.getValue().lastEntry().getValue());
} else {
for (VersionType ver : versionEntry.getValue().descendingKeySet()) {
TimelineEntry timelineEntry = versionEntry.getValue().get(ver);
if (timelineEntry.getPartitionHolder().isComplete()) {
add(timeline, versionEntry.getKey(), timelineEntry);
break;
}
}
}
}
}
}
代码示例来源:origin: apache/incubator-gobblin
Set<FileSet<CopyEntity>> partitionsToDelete = Sets.newHashSet();
for (FileSet<CopyEntity> existingFileSet : this.workUnitsMap.descendingKeySet()) {
if (this.comparator.compare(existingFileSet, fileSet) <= 0) {
return false;
代码示例来源:origin: apache/storm
public void resetLogLevels() {
TreeMap<String, LogLevel> latestLogLevelMap = latestLogConfig.get();
LOG.debug("Resetting log levels: Latest log config is {}", latestLogLevelMap);
LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
for (String loggerName : latestLogLevelMap.descendingKeySet()) {
LogLevel loggerSetting = latestLogLevelMap.get(loggerName);
long timeout = loggerSetting.get_reset_log_level_timeout_epoch();
String resetLogLevel = loggerSetting.get_reset_log_level();
if (timeout < Time.currentTimeMillis()) {
LOG.info("{}: Resetting level to {}", loggerName, resetLogLevel);
setLoggerLevel(loggerContext, loggerName, resetLogLevel);
latestLogConfig.getAndUpdate(input -> {
TreeMap<String, LogLevel> result = new TreeMap<>(input);
result.remove(loggerName);
return result;
});
}
}
loggerContext.updateLoggers();
}
代码示例来源:origin: apache/hbase
for (Integer key: overlapRangeMap.descendingKeySet()) {
List<R> chunk = overlapRangeMap.get(key);
int chunkSize = chunk.size();
代码示例来源:origin: loklak/loklak_server
list.add(exactTerm);
for (Long p: a.descendingKeySet()) {
list.add(a.get(p));
if (i >= list.size()) {
代码示例来源:origin: apache/storm
for (String loggerName : latestConf.descendingKeySet()) {
if (!newLogConfigs.containsKey(loggerName)) {
代码示例来源:origin: mahmoudparsian/data-algorithms-book
static List<Long> getTopFriends(TreeMap<Long, List<Long>> sortedMap, int N) {
// now select the top N users to recommend as potential friends
List<Long> recommendations = new ArrayList<Long>();
for (long mutualFriends : sortedMap.descendingKeySet()) {
List<Long> potentialFriends = sortedMap.get(mutualFriends);
Collections.sort(potentialFriends);
for (long potentialFriend : potentialFriends) {
recommendations.add(potentialFriend);
if (recommendations.size() == N) {
return recommendations;
}
}
}
// here we have less than N friends recommendations
return recommendations;
}
}
代码示例来源:origin: mahmoudparsian/data-algorithms-book
static List<Long> getTopFriends(TreeMap<Long, List<Long>> sortedMap, int N) {
// now select the top N users to recommend as potential friends
List<Long> recommendations = new ArrayList<Long>();
for (long mutualFriends : sortedMap.descendingKeySet()) {
List<Long> potentialFriends = sortedMap.get(mutualFriends);
Collections.sort(potentialFriends);
for (long potentialFriend : potentialFriends) {
recommendations.add(potentialFriend);
if (recommendations.size() == N) {
return recommendations;
}
}
}
// here we have less than N friends recommendations
return recommendations;
}
}
代码示例来源:origin: org.apache.uima/uima-ducc-common
public NavigableSet<Long> getDescendingKeySet() {
return map.descendingKeySet();
}
代码示例来源:origin: com.github.monnetproject/translation.phrasal
@Override
public Iterator<S> iterator() {
return hypotheses.descendingKeySet().iterator();
}
代码示例来源:origin: com.silicolife.textmining/core
@Override
public IPOSToken getPreviousElement(Long offset) {
NavigableSet<Long> tst = this.sentenceSintax.descendingKeySet();
Iterator<Long> it = this.sentenceSintax.keySet().iterator();
return null;
}
代码示例来源:origin: hudson.plugins/project-inheritance
public Version getLatestStable() {
//TODO: Buffer the latest stable version in some way
if (this.store == null || this.store.isEmpty()) {
return null;
}
//Trying to find the latest version marked as stable
NavigableSet<Version> descSet = this.store.descendingKeySet();
for (Version v : descSet) {
if (v.stable) {
return v;
}
}
//If none is found, just return the latest one
return this.store.lastKey();
}
代码示例来源:origin: i-m-c/jenkins-inheritance-plugin
public Version getLatestStable() {
//TODO: Buffer the latest stable version in some way
if (this.store == null || this.store.isEmpty()) {
return null;
}
//Trying to find the latest version marked as stable
NavigableSet<Version> descSet = this.store.descendingKeySet();
for (Version v : descSet) {
if (v.stable) {
return v;
}
}
//If none is found, just return the latest one
return this.store.lastKey();
}
代码示例来源:origin: espertechinc/esper
/**
* Ctor.
*
* @param window - sorted map with events
* @param reverse for reverse iterator
*/
public AggregationStateSortedIterator(TreeMap<Object, Object> window, boolean reverse) {
super(reverse ? window.descendingKeySet().iterator() : window.keySet().iterator());
this.window = window;
init();
}
代码示例来源:origin: geftimov/hadoop-map-reduce-patterns
@Override
public void cleanup(Context context) throws IOException,
InterruptedException {
for (int reputation : repToRecordMap.descendingKeySet()) {
Pair<Writable, Writable> pair = repToRecordMap.get(reputation);
context.write(new IntWritable(reputation),
new TextArrayWritable(pair));
}
}
}
代码示例来源:origin: com.silicolife.textmining/core
public IPOSToken getNextElement(Long offset)
{
if(this.sentenceSintax.containsKey(offset))
{
NavigableSet<Long> tst = this.sentenceSintax.descendingKeySet();
Iterator<Long> it = this.sentenceSintax.keySet().iterator();
while(it.hasNext())
{
Long offsetSintaxPosition = it.next();
if(offsetSintaxPosition>=offset)
{
IPOSToken triple = this.sentenceSintax.get(offsetSintaxPosition);
return triple;
}
}
}
return null;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
private String orderedRegex(List<String> regextokens) {
String newregex = "";
if (inputstring != null) {
String[] inputparts = inputstring.split(" ");
TreeMap<Integer,String> regexparts = new TreeMap<Integer,String>();
for (String s : regextokens) {
for (int i = 0; i < inputparts.length; i++) {
if (inputparts[i].matches(s+"(/\\w+)?")) {
regexparts.put(i,s);
break;
}
}
}
for (int n : regexparts.descendingKeySet()) {
newregex = regexparts.get(n) + " " + newregex;
}
}
else for (String s : regextokens) newregex += s + " ";
return newregex.trim();
}
代码示例来源:origin: pranab/chombo
/**
* returns set of items within confidence bound
* @param confidenceLimitPercent
* @return
*/
public List<String> getConfidenceBounds(int confidenceLimitPercent) {
List<String> confBoundSet = new ArrayList<String>();
int confidenceLimit = (sampleCount * confidenceLimitPercent) / 100;
//sort by count
TreeMap<Integer, String> countSortedHistogram = new TreeMap<Integer, String>();
for(Map.Entry<String,Integer> entry : binMap.entrySet()) {
countSortedHistogram.put(entry.getValue(), entry.getKey());
}
//collect high count items
double confCount = 0;
for(Integer count : countSortedHistogram.descendingKeySet()) {
confCount += count;
if (confCount < confidenceLimit) {
confBoundSet.add(countSortedHistogram.get(count));
}
}
return confBoundSet;
}
代码示例来源:origin: org.apache.druid/druid-common
private void remove(
NavigableMap<Interval, TimelineEntry> timeline,
Interval interval,
boolean incompleteOk
)
{
timeline.remove(interval);
for (Map.Entry<Interval, TreeMap<VersionType, TimelineEntry>> versionEntry : allTimelineEntries.entrySet()) {
if (versionEntry.getKey().overlap(interval) != null) {
if (incompleteOk) {
add(timeline, versionEntry.getKey(), versionEntry.getValue().lastEntry().getValue());
} else {
for (VersionType ver : versionEntry.getValue().descendingKeySet()) {
TimelineEntry timelineEntry = versionEntry.getValue().get(ver);
if (timelineEntry.getPartitionHolder().isComplete()) {
add(timeline, versionEntry.getKey(), timelineEntry);
break;
}
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!