本文整理匯總了Java中java.util.stream.Stream.concat方法的典型用法代碼示例。如果您正苦於以下問題:Java Stream.concat方法的具體用法?Java Stream.concat怎麽用?Java Stream.concat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.stream.Stream
的用法示例。
在下文中一共展示了Stream.concat方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: allPossible
import java.util.stream.Stream; //導入方法依賴的package包/類
Stream<Assignment> allPossible() throws Throwable {
final List<FrameworkMethod> annotatedMethods = testClass.getAnnotatedMethods(DataProducer.class);
Stream<Assignment> methodAssignments = Stream.empty();
for (FrameworkMethod annotatedMethod : annotatedMethods) {
final Type methodReturnType = getMethodGenericReturnType(annotatedMethod.getMethod());
methodAssignments = Stream.concat(methodAssignments, methodToStreamOfResults(annotatedMethod)
.map(value -> new MethodResultAssignment(value, methodReturnType, annotatedMethod)));
}
final List<FrameworkField> annotatedFields = testClass.getAnnotatedFields(DataProducer.class);
final Stream<Assignment> fieldsAssignments = annotatedFields.stream()
.map(FieldAssignment::new);
return Stream.concat(fieldsAssignments, methodAssignments);
}
示例2: providersForServices
import java.util.stream.Stream; //導入方法依賴的package包/類
@Test
public void providersForServices() throws Throwable {
if (!hasJmods()) return;
List<String> output =
JLink.run("--module-path", MODULE_PATH,
"--suggest-providers",
"java.nio.charset.spi.CharsetProvider,p1.S").output();
System.out.println(output);
Stream<String> expected = Stream.concat(
Stream.of("jdk.charsets provides java.nio.charset.spi.CharsetProvider used by java.base"),
Stream.of("m1 provides p1.S used by m1",
"m2 provides p1.S used by m1")
);
assertTrue(output.containsAll(expected.collect(Collectors.toList())));
}
示例3: keySet
import java.util.stream.Stream; //導入方法依賴的package包/類
/** Returns the fully qualified setting names contained in this settings object. */
public Set<String> keySet() {
synchronized (keys) {
if (keys.get() == null) {
if (secureSettings == null) {
keys.set(settings.keySet());
} else {
Stream<String> stream = Stream.concat(settings.keySet().stream(), secureSettings.getSettingNames().stream());
// uniquify, since for legacy reasons the same setting name may exist in both
keys.set(Collections.unmodifiableSet(stream.collect(Collectors.toSet())));
}
}
}
return keys.get();
}
示例4: stream
import java.util.stream.Stream; //導入方法依賴的package包/類
public Stream<ResultNode> stream() {
if (isContainer()) {
return Stream.concat(Stream.of(this), children.stream().flatMap((child) -> {
return child.stream();
}));
}
return Stream.of(this);
}
示例5: filterableDescendants
import java.util.stream.Stream; //導入方法依賴的package包/類
@Override
default <R extends Filterable<?>> Stream<? extends R> filterableDescendants(Class<R> type) {
Stream<R> result = Stream.of();
if(type.isAssignableFrom(Match.class)) {
result = Stream.concat(result, Stream.of((R) this));
}
if(Party.class.isAssignableFrom(type)) {
result = Stream.concat(result, Streams.instancesOf(parties(), type));
}
if(type.isAssignableFrom(MatchPlayer.class)) {
result = Stream.concat(result, (Stream<? extends R>) players());
}
return result;
}
示例6: concat
import java.util.stream.Stream; //導入方法依賴的package包/類
/**
* Concatenate streams.
*
* @param <T> Generic type of {@link Stream}
* @param s0 The first {@code Stream}.
* @param streams The {@code Stream}s to concatenate (nulls ignored).
* @return The concatenated stream.
*/
@SafeVarargs
public static <T> Stream<T> concat(Stream<T> s0, Stream<T>... streams) {
Stream<T>[] sts = streams;
Stream<T> ret = (s0 == null) ? Stream.empty() : s0;
for (int i = 0; i < sts.length; i++) {
if (sts[i] != null) ret = Stream.concat(ret, sts[i]);
}
return ret;
}
示例7: getChildren
import java.util.stream.Stream; //導入方法依賴的package包/類
@Override
public Stream<? extends CypherAstBase> getChildren() {
return Stream.concat(
returnItems.stream(),
Stream.of(order, limit, skip)
);
}
示例8: traverseFields
import java.util.stream.Stream; //導入方法依賴的package包/類
/**
* Returns a stream of all the member fields for the specified class,
* including inherited fields from any ancestors. This includes public,
* private, protected and package private fields.
*
* @param clazz the class to traverse
* @return stream of fields
*/
public static Stream<Field> traverseFields(Class<?> clazz) {
final Class<?> parent = clazz.getSuperclass();
final Stream<Field> inherited;
if (parent != null) {
inherited = traverseFields(parent);
} else {
inherited = Stream.empty();
}
return Stream.concat(inherited, Stream.of(clazz.getDeclaredFields()));
}
示例9: lazyStream
import java.util.stream.Stream; //導入方法依賴的package包/類
public Stream<TreeNode> lazyStream() {
if (isLeaf()) {
return Stream.of(this);
} else {
return Stream.concat(Stream.of(this), getChildren().stream().flatMap(TreeNode::stream));
}
}
示例10: getMethodsUpToJpaOdataEntity
import java.util.stream.Stream; //導入方法依賴的package包/類
public static Method[] getMethodsUpToJpaOdataEntity(Class<?> firstClass) {
Stream<Method> result = Stream.of(firstClass.getDeclaredMethods());
Class<?> superclass = firstClass.getSuperclass();
if (!isLastClass(superclass)) {
result = Stream.concat(result, Stream.of(getMethodsUpToJpaOdataEntity(superclass)));
}
return result.toArray(Method[]::new);
}
示例11: concatStreams
import java.util.stream.Stream; //導入方法依賴的package包/類
@SafeVarargs
private final Stream<String> concatStreams(final Stream<String>... streams) {
if (streams.length == 0)
throw new IllegalArgumentException("No stream provided");
Stream<String> currentStream = streams[0];
for (Integer i = 1; i < streams.length; i++) {
currentStream = Stream.concat(currentStream, streams[i]);
}
return currentStream;
}
示例12: filterableDescendants
import java.util.stream.Stream; //導入方法依賴的package包/類
/**
* Return all individual objects of the given Filterable subtype that this object is composed of,
* directly or indirectly, possibly including this object itself.
*
* This method simply tests this object's type, and recurses on all {@link #filterableChildren()}.
* Subclasses should provide a more efficient implementation, if possible.
*/
default <R extends Filterable<?>> Stream<? extends R> filterableDescendants(Class<R> type) {
Stream<? extends R> result = filterableChildren().flatMap(child -> child.filterableDescendants(type));
if(type.isInstance(this)) {
result = Stream.concat(Stream.of((R) this), result);
}
return result;
}
示例13: fields
import java.util.stream.Stream; //導入方法依賴的package包/類
public static Stream<Field> fields(Class<?> cls) {
return Stream.concat(
Arrays.stream(cls.getFields()),
Arrays.stream(cls.getDeclaredFields())
.filter(Util::notPublic)
);
}
示例14: dependencies
import java.util.stream.Stream; //導入方法依賴的package包/類
@Override
public Stream<? extends Kit> dependencies() {
return Stream.concat(parents.stream(), kits.dependencies());
}
示例15: reachableNodes
import java.util.stream.Stream; //導入方法依賴的package包/類
public static <T> Stream<T> reachableNodes(T node, Function<T, Stream<T>> nodeToChildren) {
Stream<T> result = Stream.concat(
Stream.of(node),
nodeToChildren.apply(node).flatMap(v -> reachableNodes(v, nodeToChildren)));
return result;
}
開發者ID:SmartDataAnalytics,項目名稱:SubgraphIsomorphismIndex,代碼行數:7,代碼來源:SubgraphIsomorphismIndexImpl.java