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

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

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

TreeSet.addAll介绍

[英]Adds the objects in the specified collection to this TreeSet.
[中]将指定集合中的对象添加到此树集中。

代码示例

代码示例来源:origin: apache/incubator-druid

public PartitionHolder(PartitionHolder partitionHolder)
{
 this.holderSet = new TreeSet<>();
 this.holderSet.addAll(partitionHolder.holderSet);
}

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

for (Iterator<Map.Entry<String, List<TopicPartition>>> it = currentAssignment.entrySet().iterator(); it.hasNext();) {
  Map.Entry<String, List<TopicPartition>> entry = it.next();
  if (!subscriptions.containsKey(entry.getKey())) {
  } else {
    for (Iterator<TopicPartition> partitionIter = entry.getValue().iterator(); partitionIter.hasNext();) {
      TopicPartition partition = partitionIter.next();
      if (!partition2AllPotentialConsumers.containsKey(partition)) {
TreeSet<String> sortedCurrentSubscriptions = new TreeSet<>(new SubscriptionComparator(currentAssignment));
sortedCurrentSubscriptions.addAll(currentAssignment.keySet());

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

@Override
public ConsumerRunningInfo consumerRunningInfo() {
  ConsumerRunningInfo info = new ConsumerRunningInfo();
  Properties prop = MixAll.object2Properties(this.defaultMQPushConsumer);
  prop.put(ConsumerRunningInfo.PROP_CONSUME_ORDERLY, String.valueOf(this.consumeOrderly));
  prop.put(ConsumerRunningInfo.PROP_THREADPOOL_CORE_SIZE, String.valueOf(this.consumeMessageService.getCorePoolSize()));
  prop.put(ConsumerRunningInfo.PROP_CONSUMER_START_TIMESTAMP, String.valueOf(this.consumerStartTimestamp));
  info.setProperties(prop);
  Set<SubscriptionData> subSet = this.subscriptions();
  info.getSubscriptionSet().addAll(subSet);
  Iterator<Entry<MessageQueue, ProcessQueue>> it = this.rebalanceImpl.getProcessQueueTable().entrySet().iterator();
  while (it.hasNext()) {
    Entry<MessageQueue, ProcessQueue> next = it.next();
    MessageQueue mq = next.getKey();
    ProcessQueue pq = next.getValue();
    ProcessQueueInfo pqinfo = new ProcessQueueInfo();
    pqinfo.setCommitOffset(this.offsetStore.readOffset(mq, ReadOffsetType.MEMORY_FIRST_THEN_STORE));
    pq.fillProcessQueueInfo(pqinfo);
    info.getMqTable().put(mq, pqinfo);
  }
  for (SubscriptionData sd : subSet) {
    ConsumeStatus consumeStatus = this.mQClientFactory.getConsumerStatsManager().consumeStatus(this.groupName(), sd.getTopic());
    info.getStatusTable().put(sd.getTopic(), consumeStatus);
  }
  return info;
}

代码示例来源:origin: apache/incubator-pinot

@Test
public void testUnionForTwoLists() {
 int[] docIds1 = new int[]{2, 3, 10, 15, 16, 28};
 int[] docIds2 = new int[]{3, 6, 8, 20, 28};
 TreeSet<Integer> treeSet = new TreeSet<>();
 treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds1)));
 treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds2)));
 Iterator<Integer> expectedIterator = treeSet.iterator();
 List<BaseFilterOperator> operators = new ArrayList<>();
 operators.add(new TestFilterOperator(docIds1));
 operators.add(new TestFilterOperator(docIds2));
 OrFilterOperator orOperator = new OrFilterOperator(operators);
 BlockDocIdIterator iterator = orOperator.nextBlock().getBlockDocIdSet().iterator();
 int docId;
 while ((docId = iterator.next()) != Constants.EOF) {
  Assert.assertEquals(docId, expectedIterator.next().intValue());
 }
}

代码示例来源:origin: spring-projects/spring-framework

TreeSet<String> thisAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
thisAttributes.addAll(getParameters().keySet());
TreeSet<String> otherAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
otherAttributes.addAll(other.getParameters().keySet());
Iterator<String> thisAttributesIterator = thisAttributes.iterator();
Iterator<String> otherAttributesIterator = otherAttributes.iterator();
while (thisAttributesIterator.hasNext()) {
  String thisAttribute = thisAttributesIterator.next();
  String otherAttribute = otherAttributesIterator.next();
  comp = thisAttribute.compareToIgnoreCase(otherAttribute);
  if (comp != 0) {

代码示例来源:origin: didi/DDMQ

@Override
public ConsumerRunningInfo consumerRunningInfo() {
  ConsumerRunningInfo info = new ConsumerRunningInfo();
  Properties prop = MixAll.object2Properties(this.defaultMQPushConsumer);
  prop.put(ConsumerRunningInfo.PROP_CONSUME_ORDERLY, String.valueOf(this.consumeOrderly));
  prop.put(ConsumerRunningInfo.PROP_THREADPOOL_CORE_SIZE, String.valueOf(this.consumeMessageService.getCorePoolSize()));
  prop.put(ConsumerRunningInfo.PROP_CONSUMER_START_TIMESTAMP, String.valueOf(this.consumerStartTimestamp));
  info.setProperties(prop);
  Set<SubscriptionData> subSet = this.subscriptions();
  info.getSubscriptionSet().addAll(subSet);
  Iterator<Entry<MessageQueue, ProcessQueue>> it = this.rebalanceImpl.getProcessQueueTable().entrySet().iterator();
  while (it.hasNext()) {
    Entry<MessageQueue, ProcessQueue> next = it.next();
    MessageQueue mq = next.getKey();
    ProcessQueue pq = next.getValue();
    ProcessQueueInfo pqinfo = new ProcessQueueInfo();
    pqinfo.setCommitOffset(this.offsetStore.readOffset(mq, ReadOffsetType.MEMORY_FIRST_THEN_STORE));
    pq.fillProcessQueueInfo(pqinfo);
    info.getMqTable().put(mq, pqinfo);
  }
  for (SubscriptionData sd : subSet) {
    ConsumeStatus consumeStatus = this.mQClientFactory.getConsumerStatsManager().consumeStatus(this.groupName(), sd.getTopic());
    info.getStatusTable().put(sd.getTopic(), consumeStatus);
  }
  return info;
}

代码示例来源:origin: apache/incubator-pinot

@Test
public void testUnionForThreeLists() {
 int[] docIds1 = new int[]{2, 3, 6, 10, 15, 16, 28};
 int[] docIds2 = new int[]{3, 6, 8, 20, 28};
 int[] docIds3 = new int[]{1, 2, 3, 6, 30};
 TreeSet<Integer> treeSet = new TreeSet<>();
 treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds1)));
 treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds2)));
 treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds3)));
 Iterator<Integer> expectedIterator = treeSet.iterator();
 List<BaseFilterOperator> operators = new ArrayList<>();
 operators.add(new TestFilterOperator(docIds1));
 operators.add(new TestFilterOperator(docIds2));
 operators.add(new TestFilterOperator(docIds3));
 OrFilterOperator orOperator = new OrFilterOperator(operators);
 BlockDocIdIterator iterator = orOperator.nextBlock().getBlockDocIdSet().iterator();
 int docId;
 while ((docId = iterator.next()) != Constants.EOF) {
  Assert.assertEquals(docId, expectedIterator.next().intValue());
 }
}

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

public void setResponseHeaders(Set<String> responseHeaders) {
    final TreeSet<String> headers = new TreeSet<>(String::compareToIgnoreCase);
    headers.addAll(responseHeaders);
    this.responseHeaders = headers;
  }
}

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

while (itCluster.hasNext()) {
  Map.Entry<String, Set<String>> next = itCluster.next();
  String clusterName = next.getKey();
  TreeSet<String> brokerNameSet = new TreeSet<String>();
  brokerNameSet.addAll(next.getValue());
      while (itAddr.hasNext()) {
        Map.Entry<Long, String> next1 = itAddr.next();
        long inTotalYest = 0;
        long outTotalYest = 0;
  if (itCluster.hasNext()) {
    System.out.printf("");

代码示例来源:origin: ron190/jsql-injection

endRequest);
  workingIt = workingSet.iterator();
  while (workingIt.hasNext()) {
    workingIt.next();
    workingIt.remove();
while (workingIt.hasNext()) {
  workingIt.next().adjustPosition(adjustment);
workingIt = workingSet.iterator();
dp = null;
if (workingIt.hasNext()) {
  dp = workingIt.next();
  this.iniPositions.addAll(this.newPositions);
  this.newPositions.clear();
} catch (IOException e) {

代码示例来源:origin: apache/incubator-pinot

@Test
 public void testComplex() {
  int[] docIds1 = new int[]{2, 3, 6, 10, 15, 16, 28};
  int[] docIds2 = new int[]{3, 6, 8, 20, 28};
  int[] docIds3 = new int[]{1, 2, 3, 6, 30};
  TreeSet<Integer> treeSet = new TreeSet<>();
  treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds1)));
  treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds2)));
  treeSet.addAll(Arrays.asList(ArrayUtils.toObject(docIds3)));
  Iterator<Integer> expectedIterator = treeSet.iterator();

  List<BaseFilterOperator> childOperators = new ArrayList<>();
  childOperators.add(new TestFilterOperator(docIds1));
  childOperators.add(new TestFilterOperator(docIds2));
  OrFilterOperator childOrOperator = new OrFilterOperator(childOperators);

  List<BaseFilterOperator> operators = new ArrayList<>();
  operators.add(childOrOperator);
  operators.add(new TestFilterOperator(docIds3));
  OrFilterOperator orOperator = new OrFilterOperator(operators);

  BlockDocIdIterator iterator = orOperator.nextBlock().getBlockDocIdSet().iterator();
  int docId;
  while ((docId = iterator.next()) != Constants.EOF) {
   Assert.assertEquals(docId, expectedIterator.next().intValue());
  }
 }
}

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

public void setRequestHeaders(Set<String> requestHeaders) {
  final TreeSet<String> headers = new TreeSet<>(String::compareToIgnoreCase);
  headers.addAll(requestHeaders);
  this.requestHeaders = headers;
}

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

while (itCluster.hasNext()) {
  Map.Entry<String, Set<String>> next = itCluster.next();
  String clusterName = next.getKey();
  TreeSet<String> brokerNameSet = new TreeSet<String>();
  brokerNameSet.addAll(next.getValue());
      while (itAddr.hasNext()) {
        Map.Entry<Long, String> next1 = itAddr.next();
        double in = 0;
        double out = 0;
  if (itCluster.hasNext()) {
    System.out.printf("");

代码示例来源:origin: FenixEdu/fenixedu-academic

@Override
public String getCurrentExecutionYearBeginDate() {
  if (registration.isInMobilityState()) {
    return readCurrentExecutionYear().getBeginDateYearMonthDay().toLocalDate().toString("dd-MM-yyyy");
  }
  StudentCurricularPlan lastStudentCurricularPlan = registration.getLastStudentCurricularPlan();
  TreeSet<Enrolment> orderedEnrolmentSet =
      new TreeSet<Enrolment>(Collections.reverseOrder(CurriculumModule.COMPARATOR_BY_CREATION_DATE));
  orderedEnrolmentSet.addAll(lastStudentCurricularPlan.getEnrolmentsByExecutionYear(readCurrentExecutionYear()));
  return orderedEnrolmentSet.isEmpty() ? "" : orderedEnrolmentSet.iterator().next().getCreationDateDateTime().toLocalDate()
      .toString("dd-MM-yyyy");
}

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

Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
  final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(COMPARATOR);
  sortedHeaders.addAll(headers);
  return sortedHeaders;
}

代码示例来源:origin: org.springframework/spring-core

TreeSet<String> thisAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
thisAttributes.addAll(getParameters().keySet());
TreeSet<String> otherAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
otherAttributes.addAll(other.getParameters().keySet());
Iterator<String> thisAttributesIterator = thisAttributes.iterator();
Iterator<String> otherAttributesIterator = otherAttributes.iterator();
while (thisAttributesIterator.hasNext()) {
  String thisAttribute = thisAttributesIterator.next();
  String otherAttribute = otherAttributesIterator.next();
  comp = thisAttribute.compareToIgnoreCase(otherAttribute);
  if (comp != 0) {

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

Set<Map.Entry<String, List<String>>> getSortedHeaders(final Set<Map.Entry<String, List<String>>> headers) {
  final TreeSet<Map.Entry<String, List<String>>> sortedHeaders = new TreeSet<Map.Entry<String, List<String>>>(COMPARATOR);
  sortedHeaders.addAll(headers);
  return sortedHeaders;
}

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

TreeSet rSet = new TreeSet(new RegionComparator());
rSet.addAll(this.cache.rootRegions());
Iterator it = rSet.iterator();
while (it.hasNext()) {
 Region root = (Region) it.next();
 Assert.assertTrue(root instanceof LocalRegion);
 if (root instanceof PartitionedRegion) {
TreeSet rColSet = new TreeSet(new RegionComparator());
rColSet.addAll(colocatedChildRegions);
Iterator colIter = rColSet.iterator();
while (colIter.hasNext()) {
 Region root = (Region) colIter.next();
 Assert.assertTrue(root instanceof LocalRegion);
 if (root instanceof PartitionedRegion) {

代码示例来源:origin: facebook/stetho

public static Set<Entry<String, ?>> getSharedPreferenceEntriesSorted(SharedPreferences preferences) {
 TreeSet<Entry<String, ?>> entries = new TreeSet<>(new Comparator<Entry<String, ?>>() {
  @Override
  public int compare(Entry<String, ?> lhs, Entry<String, ?> rhs) {
   return lhs.getKey().compareTo(rhs.getKey());
  }
 });
 entries.addAll(preferences.getAll().entrySet());
 return entries;
}

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

tx.store(metadata.page, metadataMarshaller, true);
final TreeSet<Integer> gcCandidateSet = new TreeSet<>();
if (cleanup) {
  final TreeSet<Integer> completeFileSet = new TreeSet<>(journal.getFileMap().keySet());
  gcCandidateSet.addAll(completeFileSet);
      while (iter.hasNext()) {
        Entry<String, Location> subscription = iter.next();
        int dataFileId = subscription.getValue().getDataFileId();
  while (candidates.hasNext()) {
    Integer candidate = candidates.next();
    Set<Integer> referencedFileIds = metadata.ackMessageFileMap.get(candidate);
    if (referencedFileIds != null) {

相关文章