本文整理了Java中java.util.stream.Stream.sequential()
方法的一些代码示例,展示了Stream.sequential()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stream.sequential()
方法的具体详情如下:
包路径:java.util.stream.Stream
类名称:Stream
方法名:sequential
暂无
代码示例来源:origin: speedment/speedment
/**
* Returns an equivalent stream that is sequential. May return
* itself, either because the stream was already sequential, or because
* the underlying stream state was modified to be sequential.
* <p>
* This is an intermediate operation.
*
* @return a sequential stream
*/
@Override
public MapStream<K, V> sequential() {
inner = inner.sequential();
return this;
}
代码示例来源:origin: codecentric/spring-boot-admin
private static Map<String, Object> convertHttptrace(List<Map<String, Object>> traces) {
return singletonMap("traces",
traces.stream().sequential().map(LegacyEndpointConverters::convertHttptrace).collect(toList()));
}
代码示例来源:origin: codecentric/spring-boot-admin
@SuppressWarnings("unchecked")
private static Map<String, Object> convertFlyway(List<Map<String, Object>> reports) {
Map<String, Object> flywayBeans = reports.stream()
.sequential()
.collect(toMap(r -> (String) r.get("name"),
r -> singletonMap("migrations",
LegacyEndpointConverters.convertFlywayMigrations(
(List<Map<String, Object>>) r.get("migrations")))));
return singletonMap("contexts", singletonMap("application", singletonMap("flywayBeans", flywayBeans)));
}
代码示例来源:origin: codecentric/spring-boot-admin
@SuppressWarnings("unchecked")
private static Map<String, Object> convertLiquibase(List<Map<String, Object>> reports) {
Map<String, Object> liquibaseBeans = reports.stream()
.sequential()
.collect(toMap(r -> (String) r.get("name"),
r -> singletonMap("changeSets",
LegacyEndpointConverters.convertLiquibaseChangesets(
(List<Map<String, Object>>) r.get("changeLogs")))));
return singletonMap("contexts", singletonMap("application", singletonMap("liquibaseBeans", liquibaseBeans)));
}
代码示例来源:origin: speedment/speedment
@Override
public Stream<T> sequential() {
return wrap(stream().sequential());
}
代码示例来源:origin: apache/nifi
private List<Tag> getObjectTags(ProcessContext context, FlowFile flowFile) {
final String prefix = context.getProperty(OBJECT_TAGS_PREFIX).evaluateAttributeExpressions(flowFile).getValue();
final List<Tag> objectTags = new ArrayList<>();
final Map<String, String> attributesMap = flowFile.getAttributes();
attributesMap.entrySet().stream().sequential()
.filter(attribute -> attribute.getKey().startsWith(prefix))
.forEach(attribute -> {
String tagKey = attribute.getKey();
String tagValue = attribute.getValue();
if (context.getProperty(REMOVE_TAG_PREFIX).asBoolean()) {
tagKey = tagKey.replace(prefix, "");
}
objectTags.add(new Tag(tagKey, tagValue));
});
return objectTags;
}
代码示例来源:origin: apache/incubator-druid
return segments.stream().sequential().flatMap(
(final WindowedDataSegment segment) -> {
FileInputFormat.setInputPaths(
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Stream<UpstreamEntry> transform(Stream<UpstreamEntry> upstream) {
PoissonDistribution poisson = new PoissonDistribution(
new Well19937c(seed),
subsampleRatio,
PoissonDistribution.DEFAULT_EPSILON,
PoissonDistribution.DEFAULT_MAX_ITERATIONS);
return upstream.sequential().flatMap(en -> Stream.generate(() -> en).limit(poisson.sample()));
}
}
代码示例来源:origin: line/armeria
executor.execute(() -> {
try {
final Iterator<T> it = stream.sequential().iterator();
boolean headerSent = false;
while (it.hasNext()) {
代码示例来源:origin: lenskit/lenskit
@Override
public Stream<T> sequential() {
return stream().sequential();
}
代码示例来源:origin: pholser/junit-quickcheck
@Override public Object generate(
SourceOfRandomness random,
GenerationStatus status) {
int length = length(random, status);
Object array = Array.newInstance(componentType, length);
Stream<?> items =
Stream.generate(() -> component.generate(random, status))
.sequential();
if (distinct)
items = items.distinct();
Iterator<?> iterator = items.iterator();
for (int i = 0; i < length; ++i)
Array.set(array, i, iterator.next());
return array;
}
代码示例来源:origin: my2iu/Jinq
@Override
public Stream<T> sequential()
{
realizeStream();
return wrap(wrappedStream.sequential());
}
代码示例来源:origin: pholser/junit-quickcheck
@SuppressWarnings("unchecked")
@Override public T generate(
SourceOfRandomness random,
GenerationStatus status) {
int size = size(random, status);
Generator<?> generator = componentGenerators().get(0);
Stream<?> itemStream =
Stream.generate(() -> generator.generate(random, status))
.sequential();
if (distinct)
itemStream = itemStream.distinct();
T items = empty();
itemStream.limit(size).forEach(items::add);
return items;
}
代码示例来源:origin: pholser/junit-quickcheck
@SuppressWarnings("unchecked")
@Override public T generate(
SourceOfRandomness random,
GenerationStatus status) {
int size = size(random, status);
Generator<?> keyGenerator = componentGenerators().get(0);
Stream<?> keyStream =
Stream.generate(() -> keyGenerator.generate(random, status))
.sequential();
if (distinct)
keyStream = keyStream.distinct();
T items = empty();
Generator<?> valueGenerator = componentGenerators().get(1);
keyStream
.map(key -> new SimpleEntry(key, valueGenerator.generate(random, status)))
.filter(entry -> okToAdd(entry.getKey(), entry.getValue()))
.limit(size)
.forEach(entry -> items.put(entry.getKey(), entry.getValue()));
return items;
}
代码示例来源:origin: apache/jena
private Optional<Entry<String, String>> findMapping( String uri, boolean partial )
{
return getNsPrefixMap().entrySet().stream().sequential().filter(e->{
String ss = e.getValue();
if (uri.startsWith( ss ) && (partial || ss.length() == uri.length()))
return true;
return false;
}).findFirst();
}
代码示例来源:origin: derive4j/derive4j
private Stream<Function<DeriveConfig, DeriveConfig>> deriveConfigs(TypeElement typeElement, Element element,
HashSet<AnnotationMirror> seenAnnotations) {
return element.getAnnotationMirrors().stream().sequential().filter(a -> !seenAnnotations.contains(a)).flatMap(a -> {
seenAnnotations.add(a);
return concat(deriveConfigs(typeElement, a.getAnnotationType().asElement(), seenAnnotations),
annotationConfig(typeElement, a));
});
}
代码示例来源:origin: org.derive4j/derive4j
private Stream<Function<DeriveConfig, DeriveConfig>> deriveConfigs(TypeElement typeElement, Element element,
HashSet<AnnotationMirror> seenAnnotations) {
return element.getAnnotationMirrors().stream().sequential().filter(a -> !seenAnnotations.contains(a)).flatMap(a -> {
seenAnnotations.add(a);
return concat(deriveConfigs(typeElement, a.getAnnotationType().asElement(), seenAnnotations),
annotationConfig(typeElement, a));
});
}
代码示例来源:origin: apache/jena
default Stream<Quad> findInUnionGraph(final Node s, final Node p, final Node o) {
final Set<Triple> seen = new HashSet<>();
return find(ANY, s, p, o).sequential()
.filter(q -> !q.isDefaultGraph())
.map(Quad::asTriple)
.filter(seen::add)
.map(t -> Quad.create(Quad.unionGraph, t));
}
}
代码示例来源:origin: io.mindmaps/mindmaps-graql
@Override
public Stream<Map<String, Concept>> stream(Optional<MindmapsGraph> optionalGraph, Optional<MatchOrder> order) {
MindmapsGraph graph = optionalGraph.orElseThrow(
() -> new IllegalStateException(ErrorMessage.NO_GRAPH.getMessage())
);
for (VarAdmin var : pattern.getVars()) {
var.getProperties().forEach(property -> ((VarPropertyInternal) property).checkValid(graph, var));
}
GraphTraversal<Vertex, Map<String, Vertex>> traversal = getQuery(graph, order).getTraversal();
return traversal.toStream().map(vertices -> makeResults(graph, vertices)).sequential();
}
代码示例来源:origin: apache/jena
private static List<Binding> build(List<String> items) {
return items.stream().sequential().map((s)->{
BindingMap b = BindingFactory.create() ;
b.add(var_a, NodeFactory.createLiteral(s)) ;
return b ;
}).collect(Collectors.toList()) ;
}
内容来源于网络,如有侵权,请联系作者删除!