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

x33g5p2x  于2022-01-29 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(127)

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

SortedSet.addAll介绍

暂无

代码示例

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

/**
 * Adds the given servers to the group.
 */
public void addAllServers(Collection<Address> hostPort){
 servers.addAll(hostPort);
}

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

public void addAllTables(Collection<TableName> arg) {
 tables.addAll(arg);
}

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

/**
 * Adds the sorted set of {@link LocalizedMessage} to the message collector.
 * @param messages the sorted set of {@link LocalizedMessage}.
 */
protected static void addMessages(SortedSet<LocalizedMessage> messages) {
  MESSAGE_COLLECTOR.get().addAll(messages);
}

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

private Set<GrantedAuthority> sortAuthorities(Collection<? extends GrantedAuthority> authorities) {
  SortedSet<GrantedAuthority> sortedAuthorities =
    new TreeSet<>(Comparator.comparing(GrantedAuthority::getAuthority));
  sortedAuthorities.addAll(authorities);
  return sortedAuthorities;
}

代码示例来源:origin: igniterealtime/Smack

private static void formFieldValuesToCaps(List<CharSequence> i, StringBuilder sb) {
  SortedSet<CharSequence> fvs = new TreeSet<>();
  fvs.addAll(i);
  for (CharSequence fv : fvs) {
    sb.append(fv);
    sb.append('<');
  }
}

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

public List<TopicPartition> allPartitionsSorted(Map<String, Integer> partitionsPerTopic,
                        Map<String, Subscription> subscriptions) {
  SortedSet<String> topics = new TreeSet<>();
  for (Subscription subscription : subscriptions.values())
    topics.addAll(subscription.topics());
  List<TopicPartition> allPartitions = new ArrayList<>();
  for (String topic : topics) {
    Integer numPartitionsForTopic = partitionsPerTopic.get(topic);
    if (numPartitionsForTopic != null)
      allPartitions.addAll(AbstractPartitionAssignor.partitions(topic, numPartitionsForTopic));
  }
  return allPartitions;
}

代码示例来源:origin: prestodb/presto

private static List<String> getSelectedQueryTagNames(Iterable<Suite> suites, Iterable<BenchmarkQuery> queries)
{
  SortedSet<String> tags = new TreeSet<>();
  for (Suite suite : suites) {
    for (BenchmarkQuery query : suite.selectQueries(queries)) {
      tags.addAll(query.getTags().keySet());
    }
    for (RegexTemplate regexTemplate : suite.getSchemaNameTemplates()) {
      tags.addAll(regexTemplate.getFieldNames());
    }
  }
  return ImmutableList.copyOf(tags);
}

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

List<Object> getSupportedEncodings() {
    // no need for synchronization - in case of a race condition, the property
    // may be set twice, but it does not break anything
    if (supportedEncodings == null) {
      SortedSet<String> se = new TreeSet<>();
      List<ContentEncoder> encoders = injectionManager.getAllInstances(ContentEncoder.class);
      for (ContentEncoder encoder : encoders) {
        se.addAll(encoder.getSupportedEncodings());
      }
      supportedEncodings = new ArrayList<>(se);
    }
    return supportedEncodings;
  }
}

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

List<Object> getSupportedEncodings() {
    // no need for synchronization - in case of a race condition, the property
    // may be set twice, but it does not break anything
    if (supportedEncodings == null) {
      SortedSet<String> se = new TreeSet<>();
      List<ContentEncoder> encoders = injectionManager.getAllInstances(ContentEncoder.class);
      for (ContentEncoder encoder : encoders) {
        se.addAll(encoder.getSupportedEncodings());
      }
      supportedEncodings = new ArrayList<>(se);
    }
    return supportedEncodings;
  }
}

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

public Set<String> rolesThatCanOperateOnStage(CruiseConfig cruiseConfig, PipelineConfig pipelineConfig) {
  PipelineConfigs group = cruiseConfig.findGroupOfPipeline(pipelineConfig);
  SortedSet<String> roles = new TreeSet<>();
  if (group.hasAuthorizationDefined()) {
    if (group.hasOperationPermissionDefined()) {
      roles.addAll(group.getOperateRoleNames());
    }
  } else {
    roles.addAll(allRoleNames(cruiseConfig));
  }
  return roles;
}

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * @param strings The completer strings
 */
public StringsCompleter(final Collection<String> strings) {
  checkNotNull(strings);
  getStrings().addAll(strings);
}

代码示例来源:origin: prestodb/presto

@Override
public int complete(String buffer, int cursor, List<CharSequence> candidates)
{
  if (cursor <= 0) {
    return cursor;
  }
  int blankPos = findLastBlank(buffer.substring(0, cursor));
  String prefix = buffer.substring(blankPos + 1, cursor);
  String schemaName = queryRunner.getSession().getSchema();
  if (schemaName != null) {
    List<String> functionNames = functionCache.getIfPresent(schemaName);
    List<String> tableNames = tableCache.getIfPresent(schemaName);
    SortedSet<String> sortedCandidates = new TreeSet<>();
    if (functionNames != null) {
      sortedCandidates.addAll(filterResults(functionNames, prefix));
    }
    if (tableNames != null) {
      sortedCandidates.addAll(filterResults(tableNames, prefix));
    }
    candidates.addAll(sortedCandidates);
  }
  return blankPos + 1;
}

代码示例来源:origin: google/guava

@SuppressWarnings("CollectionIncompatibleType") // testing incompatible types
public void testContainsAll_sameComparator_StringVsInt() {
 SortedSet<String> set = of("a", "b", "f");
 SortedSet<Integer> unexpected = Sets.newTreeSet(Ordering.natural());
 unexpected.addAll(asList(1, 2, 3));
 assertFalse(set.containsAll(unexpected));
}

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

@Override
public GapAwareTrackingToken lowerBound(TrackingToken other) {
  Assert.isTrue(other instanceof GapAwareTrackingToken, () -> "Incompatible token type provided.");
  GapAwareTrackingToken otherToken = (GapAwareTrackingToken) other;
  SortedSet<Long> mergedGaps = new ConcurrentSkipListSet<>(this.gaps);
  mergedGaps.addAll(otherToken.gaps);
  long mergedIndex = calculateIndex(otherToken, mergedGaps);
  mergedGaps.removeIf(i -> i >= mergedIndex);
  return new GapAwareTrackingToken(mergedIndex, mergedGaps);
}

代码示例来源:origin: google/guava

void ensureNotDirectlyModifiable(SortedSet<Integer> unmod) {
 try {
  unmod.add(4);
  fail("UnsupportedOperationException expected");
 } catch (UnsupportedOperationException expected) {
 }
 try {
  unmod.remove(4);
  fail("UnsupportedOperationException expected");
 } catch (UnsupportedOperationException expected) {
 }
 try {
  unmod.addAll(Collections.singleton(4));
  fail("UnsupportedOperationException expected");
 } catch (UnsupportedOperationException expected) {
 }
 try {
  Iterator<Integer> iterator = unmod.iterator();
  iterator.next();
  iterator.remove();
  fail("UnsupportedOperationException expected");
 } catch (UnsupportedOperationException expected) {
 }
}

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

public Set<String> usersThatCanOperateOnStage(CruiseConfig cruiseConfig, PipelineConfig pipelineConfig) {
  SortedSet<String> users = new TreeSet<>();
  PipelineConfigs group = cruiseConfig.findGroupOfPipeline(pipelineConfig);
  if (group.hasAuthorizationDefined()) {
    if (group.hasOperationPermissionDefined()) {
      users.addAll(group.getOperateUserNames());
      List<String> roles = group.getOperateRoleNames();
      for (Role role : cruiseConfig.server().security().getRoles()) {
        if (roles.contains(CaseInsensitiveString.str(role.getName()))) {
          users.addAll(role.usersOfRole());
        }
      }
    }
  } else {
    users.addAll(allUsernames());
  }
  return users;
}

代码示例来源:origin: commons-collections/commons-collections

public Set makeFullSet() {
  SortedSet set = new TreeSet();
  set.addAll(Arrays.asList(getFullElements()));
  return TransformedSortedSet.decorate(set, TestTransformedCollection.NOOP_TRANSFORMER);
}

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

SortedSet<Invoice> unpaidInvoicesForAccount(final UUID accountId, final InternalCallContext context) {
    final Collection<Invoice> invoices = invoiceApi.getUnpaidInvoicesByAccountId(accountId, context.toLocalDate(context.getCreatedDate()), context);
    final SortedSet<Invoice> sortedInvoices = new TreeSet<Invoice>(new InvoiceDateComparator());
    sortedInvoices.addAll(invoices);
    return sortedInvoices;
  }
}

代码示例来源:origin: commons-collections/commons-collections

public AbstractTestSortedBidiMap() {
  super();
  sortedKeys.addAll(Arrays.asList(getSampleValues()));
  Collections.sort(sortedKeys);
  sortedKeys = Collections.unmodifiableList(sortedKeys);
  
  Map map = new TreeMap();
  for (int i = 0; i < getSampleKeys().length; i++) {
    map.put(getSampleValues()[i], getSampleKeys()[i]);
  }
  sortedValues.addAll(map.values());
  sortedValues = Collections.unmodifiableList(sortedValues);
  
  sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
}

代码示例来源:origin: commons-collections/commons-collections

public AbstractTestSortedBidiMap(String testName) {
  super(testName);
  sortedKeys.addAll(Arrays.asList(getSampleKeys()));
  Collections.sort(sortedKeys);
  sortedKeys = Collections.unmodifiableList(sortedKeys);
  
  Map map = new TreeMap();
  for (int i = 0; i < getSampleKeys().length; i++) {
    map.put(getSampleKeys()[i], getSampleValues()[i]);
  }
  sortedValues.addAll(map.values());
  sortedValues = Collections.unmodifiableList(sortedValues);
  
  sortedNewValues.addAll(Arrays.asList(getNewSampleValues()));
}

相关文章