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

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

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

SortedSet.stream介绍

暂无

代码示例

代码示例来源:origin: Graylog2/graylog2-server

private Collection<String> referencedRules(String pipelineSource) {
    final Pipeline pipeline = pipelineRuleParser.parsePipeline("dummy", pipelineSource);
    return pipeline.stages().stream()
        .map(Stage::ruleReferences)
        .flatMap(Collection::stream)
        .map(ruleService::findByName)
        .filter(Optional::isPresent)
        .map(Optional::get)
        .map(RuleDao::id)
        .collect(Collectors.toSet());
  }
}

代码示例来源:origin: JanusGraph/janusgraph

@Override
public Iterable<Vertex> getNeighbors(final int value) {
  return outEdges.stream()
    .filter(edge -> (Integer) edge.getProperty("number") == value)
    .map(Edge::getEnd)
    .collect(Collectors.toSet());
}

代码示例来源:origin: SonarSource/sonarqube

public Map<String, QualityProfile> getProfilesByKey() {
 return profiles.stream().collect(uniqueIndex(QualityProfile::getQpKey, identity()));
}

代码示例来源:origin: JanusGraph/janusgraph

@Override
    public Iterable<Vertex> getNeighbors(final int value) {
//            SortedSet<ByteEntry> set = (SortedSet<ByteEntry>) tx.get(id);
      return set.stream()
        .filter(entry -> entry.value.getInt(0) == value)
        .map(entry -> new ByteVertex(entry.key.getLong(8), tx))
        .collect(Collectors.toSet());
    }
  }

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

/**
 * Find the patterns matching the given lookup path. Invoking this method should
 * yield results equivalent to those of calling
 * {@link #getMatchingCondition(ServerWebExchange)}.
 * This method is provided as an alternative to be used if no request is available
 * (e.g. introspection, tooling, etc).
 * @param exchange the current exchange
 * @return a sorted set of matching patterns sorted with the closest match first
 */
private SortedSet<PathPattern> getMatchingPatterns(ServerWebExchange exchange) {
  PathContainer lookupPath = exchange.getRequest().getPath().pathWithinApplication();
  return this.patterns.stream()
      .filter(pattern -> pattern.matches(lookupPath))
      .collect(Collectors.toCollection(TreeSet::new));
}

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

public Collection<Frequency> getFrequencies (String trip_id) {
  // IntelliJ tells me all these casts are unnecessary, and that's also my feeling, but the code won't compile
  // without them
  return (List<Frequency>) frequencies.subSet(new Fun.Tuple2(trip_id, null), new Fun.Tuple2(trip_id, Fun.HI)).stream()
      .map(t2 -> ((Tuple2<String, Frequency>) t2).b)
      .collect(Collectors.toList());
}

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

deadWorkerDirs.stream().map(File::getName).collect(joining(",")));

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

.stream()
.noneMatch(
  prop ->

代码示例来源:origin: linkedin/cruise-control

/**
 * Get brokers that the rebalance process will go over to apply balancing actions to rep licas they contain.
 *
 * @param clusterModel The state of the cluster.
 * @return A collection of brokers that the rebalance process will go over to apply balancing actions to replicas
 * they contain.
 */
@Override
protected SortedSet<Broker> brokersToBalance(ClusterModel clusterModel) {
 if (!clusterModel.deadBrokers().isEmpty()) {
  return clusterModel.deadBrokers();
 }
 if (_currentRebalanceTopic == null) {
  return Collections.emptySortedSet();
 }
 // Brokers having over minimum number of replicas per broker for the current rebalance topic are eligible for balancing.
 SortedSet<Broker> brokersToBalance = new TreeSet<>();
 int minNumReplicasPerBroker = _replicaDistributionTargetByTopic.get(_currentRebalanceTopic).minNumReplicasPerBroker();
 brokersToBalance.addAll(clusterModel.brokers().stream()
   .filter(broker -> broker.replicasOfTopicInBroker(_currentRebalanceTopic).size() > minNumReplicasPerBroker)
   .collect(Collectors.toList()));
 return brokersToBalance;
}

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

List<String> reorderedFilesStr = logFiles.stream()
    .map(WorkerLogs::getTopologyPortWorkerLog)
    .filter(fileStr -> !StringUtils.equals(fileName, fileStr))

代码示例来源:origin: Graylog2/graylog2-server

final Set<String> indexRangesWithoutStreams = indexRangeService.findAll().stream()
    .filter(indexRange -> defaultIndexSet.isManagedIndex(indexRange.indexName()))
    .filter(indexRange -> indexRange.streamIds() == null)

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

Set<String> invalidProjects = projects.stream().
  filter(proj -> (Project.getByName(proj) == null)).
  collect(Collectors.toSet());
  projects.stream().
  map(x -> Project.getByName(x)).
  filter(proj -> !proj.isIndexed()).

代码示例来源:origin: floragunncom/search-guard

private Settings.Builder getMinimumNonSgNodeSettingsBuilder(final int nodenum, final boolean masterNode,
    final boolean dataNode, final boolean tribeNode, int nodeCount, int masterCount, SortedSet<Integer> tcpPorts, int tcpPort, int httpPort) {
  return Settings.builder()
      .put("node.name", "node_"+clustername+ "_num" + nodenum)
      .put("node.data", dataNode)
      .put("node.master", masterNode)
      .put("cluster.name", clustername)
      .put("path.data", "data/"+clustername+"/data")
      .put("path.logs", "data/"+clustername+"/logs")
      .put("node.max_local_storage_nodes", nodeCount)
      .put("discovery.zen.minimum_master_nodes", minMasterNodes(masterCount))
      .put("discovery.zen.no_master_block", "all")
      .put("discovery.zen.fd.ping_timeout", "5s")
      .put("discovery.initial_state_timeout","8s")
      .putList("discovery.zen.ping.unicast.hosts", tcpPorts.stream().map(s->"127.0.0.1:"+s).collect(Collectors.toList()))
      .put("transport.tcp.port", tcpPort)
      .put("http.port", httpPort)
      .put("http.enabled", true)
      .put("cluster.routing.allocation.disk.threshold_enabled", false)
      .put("http.cors.enabled", true)
      .put("path.home", ".");
}
// @formatter:on

代码示例来源:origin: SonarSource/sonarqube

private void initNewDuplicated(Component component, Set<Integer> changedLines) {
  DuplicationCounters duplicationCounters = new DuplicationCounters(changedLines);
  Iterable<Duplication> duplications = duplicationRepository.getDuplications(component);
  for (Duplication duplication : duplications) {
   duplicationCounters.addBlock(duplication.getOriginal());
   duplication.getDuplicates().stream()
    .filter(InnerDuplicate.class::isInstance)
    .map(duplicate -> (InnerDuplicate) duplicate)
    .forEach(duplicate -> duplicationCounters.addBlock(duplicate.getTextBlock()));
  }
  newDuplicatedLines.increment(duplicationCounters.getNewLinesDuplicated());
  newDuplicatedBlocks.increment(duplicationCounters.getNewBlocksDuplicated());
 }
}

代码示例来源:origin: linkedin/cruise-control

eligibleBrokers(replica, clusterModel).stream().map(BrokerReplicaCount::broker).collect(Collectors.toList());

代码示例来源:origin: floragunncom/search-guard

assert freePorts.size() == internalNodeSettings.size()*2;
final SortedSet<Integer> tcpPorts = new TreeSet<Integer>();
freePorts.stream().limit(internalNodeSettings.size()).forEach(el->tcpPorts.add(el));
final Iterator<Integer> tcpPortsIt = tcpPorts.iterator();
freePorts.stream().skip(internalNodeSettings.size()).limit(internalNodeSettings.size()).forEach(el->httpPorts.add(el));
final Iterator<Integer> httpPortsIt = httpPorts.iterator();

代码示例来源:origin: reactor/reactor-core

.stream()
                       .skip(1)
                       .filter(fl -> fl.name().length() >= 4)
    .allSatisfy(fl -> assertThat(fl.name()).startsWith("p"));
assertThat(layout.fields().subSet(wip.get(), requested.get()).stream().skip(1))
    .as("wip-requested padding")
    .hasSize(15)
         .stream()
         .skip(1))
    .as("requested post-padding")

代码示例来源:origin: KronicDeth/intellij-elixir

@Test
public void elixirModule() throws IOException, OtpErlangDecodeException {
  Beam beam = beam("Elixir.Kernel");
  assertNotNull(beam);
  Atoms atoms = beam.atoms();
  assertNotNull(atoms);
  assertEquals("Elixir.Kernel", atoms.moduleName());
  long callDefinitionCount = beam.callDefinitionsList(atoms).stream().mapToInt(CallDefinitions::size).sum();
  assertTrue("There are no callDefinitions", callDefinitionCount > 0);
  SortedSet<MacroNameArity> macroNameAritySortedSet = CallDefinitions.macroNameAritySortedSet(beam, atoms);
  assertEquals("There are nameless callDefinitions", callDefinitionCount, macroNameAritySortedSet.size());
  Stream<MacroNameArity> macroNameArityStream = macroNameAritySortedSet.stream().filter(
      macroNameArity -> "node".equals(macroNameArity.name)
  );
  MacroNameArity[] macroNameArities = macroNameArityStream.toArray(MacroNameArity[]::new);
  assertEquals(2, macroNameArities.length);
  assertEquals(0, (int) macroNameArities[0].arity);
  assertEquals(1, (int) macroNameArities[1].arity);
}

代码示例来源:origin: Graylog2/graylog2-server

public static PipelineSource fromDao(PipelineRuleParser parser, PipelineDao dao) {
  Set<ParseError> errors = null;
  Pipeline pipeline = null;
  try {
    pipeline = parser.parsePipeline(dao.id(), dao.source());
  } catch (ParseException e) {
    errors = e.getErrors();
  }
  final List<StageSource> stageSources = (pipeline == null) ? Collections.emptyList() :
      pipeline.stages().stream()
          .map(stage -> StageSource.builder()
              .matchAll(stage.matchAll())
              .rules(stage.ruleReferences())
              .stage(stage.stage())
              .build())
          .collect(Collectors.toList());
  return builder()
      .id(dao.id())
      .title(dao.title())
      .description(dao.description())
      .source(dao.source())
      .createdAt(dao.createdAt())
      .modifiedAt(dao.modifiedAt())
      .stages(stageSources)
      .errors(errors)
      .build();
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Procedure
@Description("apoc.spatial.sortPathsByDistance(List<Path>) sort the given paths based on the geo informations (lat/long) in ascending order")
public Stream<DistancePathResult> sortByDistance(@Name("paths")List<Path> paths) {
  return paths.size() > 0 ? sortPaths(paths).stream() : Stream.empty();
}

相关文章