java.util.TreeSet.descendingIterator()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中java.util.TreeSet.descendingIterator()方法的一些代码示例,展示了TreeSet.descendingIterator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeSet.descendingIterator()方法的具体详情如下:
包路径:java.util.TreeSet
类名称:TreeSet
方法名:descendingIterator

TreeSet.descendingIterator介绍

暂无

代码示例

代码示例来源:origin: apache/geode

ReceivedVersionsReverseIteratorT() {
 if (received == null) {
  this.noIterator = true;
 } else {
  this.treeSetIterator = received.descendingIterator();
 }
}

代码示例来源:origin: atomix/atomix

@Override
public Iterator<E> descendingIterator() {
 return set().descendingIterator();
}

代码示例来源:origin: stackoverflow.com

import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.TreeSet;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class Streams {
  public static void main(String... args) {
    TreeSet<String> set = new TreeSet<>();
    set.add("C");
    set.add("A");
    set.add("B");

    Iterator<String> iterator = set.descendingIterator();

    int characteristics = Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED;
    Spliterator<String> spliterator = Spliterators.spliteratorUnknownSize(iterator, characteristics);

    boolean parallel = false;
    Stream<String> stream = StreamSupport.stream(spliterator, parallel);

    stream.forEach(System.out::println); // prints C, then B, then A
  }
}

代码示例来源:origin: facebook/facebook-android-sdk

allAvailableFacebookAppVersions.descendingIterator();
int latestFacebookAppVersion = -1;

代码示例来源:origin: apache/geode

for (Iterator<Long> it = this.received.descendingIterator(); it.hasNext();) {
 long v = it.next();
 if (v >= this.nextVersion - 1) {

代码示例来源:origin: alibaba/jstorm

private void setTaskInfo(StormTopology oldTopology, StormTopology newTopology) throws Exception {
  StormClusterState clusterState = data.getStormClusterState();
  // Retrieve the max task ID
  TreeSet<Integer> taskIds = new TreeSet<>(clusterState.task_ids(topologyId));
  int cnt = taskIds.descendingIterator().next();
  cnt = setBoltInfo(oldTopology, newTopology, cnt, clusterState);
  cnt = setSpoutInfo(oldTopology, newTopology, cnt, clusterState);
}

代码示例来源:origin: apache/hive

WM_LOG.info("At priority " + entry.getKey() + " observing " + entry.getValue().size());
Iterator<TaskInfo> atPriorityIter = newValue ? atPriority.iterator() : atPriority.descendingIterator();
TreeMap<Integer, TreeSet<TaskInfo>> toMap = newValue ? guaranteedTasks : speculativeTasks,
  fromMap = newValue ? speculativeTasks : guaranteedTasks;

代码示例来源:origin: redisson/redisson

Iterator<Integer> indicies2remove = toRemove.descendingIterator();
while (indicies2remove.hasNext()) {
  nodeValue.remove(indicies2remove.next().intValue());

代码示例来源:origin: alibaba/jstorm

int removedTaskNum = oldBolt.get_common().get_parallelism_hint() - bolt.get_common().get_parallelism_hint();
TreeSet<Integer> taskIds = new TreeSet<>(clusterState.task_ids_by_componentId(topologyId, boltName));
Iterator<Integer> descendIterator = taskIds.descendingIterator();
while (--removedTaskNum >= 0) {
  int taskId = descendIterator.next();

代码示例来源:origin: apache/hbase

@Test
public void testIncrementalBackupTableSet() throws IOException {
 TreeSet<TableName> tables1 = new TreeSet<>();
 tables1.add(TableName.valueOf("t1"));
 tables1.add(TableName.valueOf("t2"));
 tables1.add(TableName.valueOf("t3"));
 TreeSet<TableName> tables2 = new TreeSet<>();
 tables2.add(TableName.valueOf("t3"));
 tables2.add(TableName.valueOf("t4"));
 tables2.add(TableName.valueOf("t5"));
 table.addIncrementalBackupTableSet(tables1, "root");
 BackupSystemTable table = new BackupSystemTable(conn);
 TreeSet<TableName> res1 = (TreeSet<TableName>) table.getIncrementalBackupTableSet("root");
 assertTrue(tables1.size() == res1.size());
 Iterator<TableName> desc1 = tables1.descendingIterator();
 Iterator<TableName> desc2 = res1.descendingIterator();
 while (desc1.hasNext()) {
  assertEquals(desc1.next(), desc2.next());
 }
 table.addIncrementalBackupTableSet(tables2, "root");
 TreeSet<TableName> res2 = (TreeSet<TableName>) table.getIncrementalBackupTableSet("root");
 assertTrue((tables2.size() + tables1.size() - 1) == res2.size());
 tables1.addAll(tables2);
 desc1 = tables1.descendingIterator();
 desc2 = res2.descendingIterator();
 while (desc1.hasNext()) {
  assertEquals(desc1.next(), desc2.next());
 }
 cleanBackupTable();
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

Iterator<Integer> indicies2remove = toRemove.descendingIterator();
while (indicies2remove.hasNext()) {
  nodeValue.remove(indicies2remove.next().intValue());

代码示例来源:origin: alibaba/jstorm

int removedTaskNum = oldSpout.get_common().get_parallelism_hint() - spout.get_common().get_parallelism_hint();
TreeSet<Integer> taskIds = new TreeSet<>(clusterState.task_ids_by_componentId(topologyId, spoutName));
Iterator<Integer> descendIterator = taskIds.descendingIterator();
while (--removedTaskNum >= 0) {
  int taskId = descendIterator.next();

代码示例来源:origin: killbill/killbill

private void cancelNextChangeEvent(final UUID subscriptionId) {
  synchronized (events) {
    final Iterator<SubscriptionBaseEvent> it = events.descendingIterator();
    while (it.hasNext()) {
      final SubscriptionBaseEvent cur = it.next();
      if (cur.getSubscriptionId() != subscriptionId) {
        continue;
      }
      if (cur.getType() == EventType.API_USER &&
        ApiEventType.CHANGE == ((ApiEvent) cur).getApiEventType() &&
        cur.getEffectiveDate().isAfter(clock.getUTCNow())) {
        it.remove();
        break;
      }
    }
  }
}

代码示例来源:origin: oracle/opengrok

throw new HistoryException("Tag list was not created before assigning tags to changesets!");
Iterator<TagEntry> it = this.getTagList().descendingIterator();
TagEntry lastTagEntry = null;

代码示例来源:origin: killbill/killbill

private void undoPendingOperation(final DefaultSubscriptionBase subscription, final List<SubscriptionBaseEvent> inputEvents,
                 final ApiEventType  targetType, final InternalCallContext context) {
  synchronized (events) {
    boolean foundEvent = false;
    final Iterator<SubscriptionBaseEvent> it = events.descendingIterator();
    while (it.hasNext()) {
      final SubscriptionBaseEvent cur = it.next();
      if (cur.getSubscriptionId() != subscription.getId()) {
        continue;
      }
      if (cur.getType() == EventType.API_USER &&
        ((ApiEvent) cur).getApiEventType() == targetType) {
        it.remove();
        foundEvent = true;
        break;
      }
    }
    if (foundEvent) {
      for (final SubscriptionBaseEvent cur : inputEvents) {
        insertEvent(cur, context);
      }
    }
  }
}

代码示例来源:origin: killbill/killbill

private void cancelNextPhaseEvent(final UUID subscriptionId,  final Catalog catalog, final InternalTenantContext context) {
  final SubscriptionBase curSubscription = getSubscriptionFromId(subscriptionId, catalog, context);
  if (curSubscription.getCurrentPhase() == null ||
    curSubscription.getCurrentPhase().getDuration().getUnit() == TimeUnit.UNLIMITED) {
    return;
  }
  synchronized (events) {
    final Iterator<SubscriptionBaseEvent> it = events.descendingIterator();
    while (it.hasNext()) {
      final SubscriptionBaseEvent cur = it.next();
      if (cur.getSubscriptionId() != subscriptionId) {
        continue;
      }
      if (cur.getType() == EventType.PHASE &&
        cur.getEffectiveDate().isAfter(clock.getUTCNow())) {
        it.remove();
        break;
      }
    }
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public Iterator descendingIterator() {
  if (_directAccess) {
    return super.descendingIterator();
  }
  if (isDelayLoad()) {
    load();
  }
  Iterator localIterator = super.descendingIterator();
  return ProxyCollections.afterIterator(this, localIterator);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

@Override
public Iterator descendingIterator() {
  if (_directAccess) {
    return super.descendingIterator();
  }
  if (isDelayLoad()) {
    load();
  }
  Iterator localIterator = super.descendingIterator();
  return ProxyCollections.afterIterator(this, localIterator);
}

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

@Override
public Iterator descendingIterator() {
  if (_directAccess) {
    return super.descendingIterator();
  }
  if (isDelayLoad()) {
    load();
  }
  Iterator localIterator = super.descendingIterator();
  return ProxyCollections.afterIterator(this, localIterator);
}

代码示例来源:origin: com.alibaba.jstorm/jstorm-core

private void setTaskInfo(StormTopology oldTopology, StormTopology newTopology) throws Exception {
  StormClusterState clusterState = data.getStormClusterState();
  // Retrieve the max task ID
  TreeSet<Integer> taskIds = new TreeSet<Integer>(clusterState.task_ids(topologyid));
  int cnt = taskIds.descendingIterator().next();
  cnt = setBoltInfo(oldTopology, newTopology, cnt, clusterState);
  cnt = setSpoutInfo(oldTopology, newTopology, cnt, clusterState);
}

相关文章