本文整理了Java中java.util.Deque.stream()
方法的一些代码示例,展示了Deque.stream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Deque.stream()
方法的具体详情如下:
包路径:java.util.Deque
类名称:Deque
方法名:stream
暂无
代码示例来源:origin: perwendel/spark
public String getPaths() {
return pathDeque.stream().collect(Collectors.joining(""));
}
代码示例来源:origin: org.junit.jupiter/junit-jupiter-api
static String formatIndexes(Deque<Integer> indexes) {
if (indexes == null || indexes.isEmpty()) {
return "";
}
String indexesString = indexes.stream().map(Object::toString).collect(joining("][", "[", "]"));
return " at index " + indexesString;
}
代码示例来源:origin: graphql-java/graphql-java
private List<String> mkPath(Deque<T> copy) {
return copy.stream()
.filter(node1 -> node1 instanceof NamedNode)
.map(node1 -> ((NamedNode) node1).getName())
.collect(Collectors.toList());
}
代码示例来源:origin: graphql-java/graphql-java
SchemaGeneratorDirectiveHelper.Parameters mkBehaviourParams() {
List<NamedNode> list = nodeStack.stream()
.filter(NamedNode.class::isInstance)
.map(NamedNode.class::cast)
.collect(Collectors.toList());
Deque<NamedNode> deque = new ArrayDeque<>(list);
return new SchemaGeneratorDirectiveHelper.Parameters(typeRegistry, wiring, new NodeParentTree<>(deque), directiveBehaviourContext, codeRegistry);
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Stops the scheduler and all tasks.
*/
public void stop() {
cancelAllTasks();
worlds.stop();
executor.shutdownNow();
asyncTaskExecutor.shutdown();
synchronized (inTickTaskCondition) {
inTickTasks.stream().filter(task -> task instanceof Future)
.forEach(task -> ((Future) task).cancel(false));
inTickTasks.clear();
}
}
代码示例来源:origin: apache/hbase
/**
* Checks whether there is any invalid family name in HFiles to be bulk loaded.
*/
private void validateFamiliesInHFiles(Table table, Deque<LoadQueueItem> queue, boolean silence)
throws IOException {
Set<String> familyNames = Arrays.asList(table.getDescriptor().getColumnFamilies()).stream()
.map(f -> f.getNameAsString()).collect(Collectors.toSet());
List<String> unmatchedFamilies = queue.stream().map(item -> Bytes.toString(item.getFamily()))
.filter(fn -> !familyNames.contains(fn)).distinct().collect(Collectors.toList());
if (unmatchedFamilies.size() > 0) {
String msg =
"Unmatched family names found: unmatched family names in HFiles to be bulkloaded: " +
unmatchedFamilies + "; valid family names of table " + table.getName() + " are: " +
familyNames;
LOG.error(msg);
if (!silence) {
throw new IOException(msg);
}
}
}
代码示例来源:origin: oracle/helidon
private Stream<InternalReader<?>> readersWithDefaults() {
return Stream.concat(readers.stream(), Stream.of(
reader(String.class, stringContentReader()),
reader(byte[].class, ContentReaders.byteArrayReader()),
reader(InputStream.class, ContentReaders.inputStreamReader())));
}
代码示例来源:origin: magefree/mage
/**
* Returns the cards of the library in a list ordered from top to buttom
*
* @param game
* @return
*/
public List<Card> getCards(Game game) {
return library.stream().map(game::getCard).collect(Collectors.toList());
}
代码示例来源:origin: org.eclipse.jetty/jetty-util
public String dump(TimeUnit units)
{
long now = System.nanoTime();
synchronized(this)
{
String samples = _samples.stream()
.mapToLong(t -> units.convert(now - t, TimeUnit.NANOSECONDS))
.mapToObj(Long::toString)
.collect(Collectors.joining(System.lineSeparator()));
return String.format("%s%n%s", toString(now), samples);
}
}
代码示例来源:origin: magefree/mage
public int count(FilterCard filter, Game game) {
return (int) library.stream().filter(cardId -> filter.match(game.getCard(cardId), game)).count();
}
代码示例来源:origin: aol/cyclops
public final static <T> boolean endsWith(final Stream<T> stream, final Iterable<T> iterable) {
Tuple2<Integer,Iterator<T>> sizeAndIterator = findSize(iterable);
final Deque<T> list = new ArrayDeque<T>(sizeAndIterator._1());
stream.forEach(v -> {
list.add(v);
if (list.size() > sizeAndIterator._1())
list.remove();
});
return startsWith(list.stream(), sizeAndIterator._2());
}
代码示例来源:origin: aol/cyclops
@Test
public void testMutableDequeConcat() {
Deque<Integer> one = new LinkedList<>();
one.add(1);
one.add(2);
one.add(3);
Deque<Integer> two = new LinkedList<>();
two.add(4);
two.add(5);
two.add(6);
Deque<Integer> result = BiFunctions.<Integer>mutableDequeConcat().apply(one, two);
assertThat(result.stream().collect(Collectors.toList()),equalTo(asList(1,2,3,4,5,6)));
}
代码示例来源:origin: SonarSource/sonar-java
private boolean handleControlFlowInFinally(Tree.Kind jumpKind) {
if (jumpKind == Tree.Kind.BREAK_STATEMENT || jumpKind == Tree.Kind.CONTINUE_STATEMENT) {
return false;
} else {
Tree.Kind parentOfControlFlowStatement = treeKindStack.stream()
.filter(t -> t == Tree.Kind.BLOCK || t == Tree.Kind.METHOD)
.findFirst()
.orElse(Tree.Kind.METHOD);
return parentOfControlFlowStatement == Tree.Kind.BLOCK;
}
}
代码示例来源:origin: cdapio/cdap
@Override
public Iterable<TransactionAware> getTransactionAwares() {
return (txContext == null)
? NO_TX_AWARES
: Stream.concat(activeTxAwares.values().stream(), extraTxAwares.stream())::iterator;
}
代码示例来源:origin: yahoo/elide
/**
* Convert a deque to a list.
*
* @param deque Deque to convert
* @return Deque as a list
*/
private static List<String> dequeToList(final Deque<String> deque) {
ArrayList<String> result = new ArrayList<>();
deque.stream().forEachOrdered(result::add);
result.sort(String.CASE_INSENSITIVE_ORDER);
return Collections.unmodifiableList(result);
}
代码示例来源:origin: stanford-futuredata/macrobase
private void calcCumSum() {
int[] inlierCounts = inlierPaneCounts.stream().mapToInt(i->i).toArray();
int[] outlierCounts = outlierPaneCounts.stream().mapToInt(i->i).toArray();
inlierCountCumSum = new ArrayList<>(inlierPaneCounts.size() + 1);
outlierCountCumSum = new ArrayList<>(inlierPaneCounts.size() + 1);
inlierCountCumSum.add(0);
outlierCountCumSum.add(0);
for (int i = 0; i < inlierPaneCounts.size(); i ++) {
inlierCountCumSum.add(inlierCountCumSum.get(i) + (int)inlierCounts[i]);
outlierCountCumSum.add(outlierCountCumSum.get(i) + (int)outlierCounts[i]);
}
}
代码示例来源:origin: jpmml/jpmml-evaluator
private TreeModel getTreeModel(){
Deque<PMMLObject> parents = getParents();
return (TreeModel)parents.stream()
.filter(TreeModel.class::isInstance)
.findFirst().get();
}
}
代码示例来源:origin: jenetics/jenetics
@Override
public Spliterator<T> trySplit() {
final List<Spliterator<T>> split = _spliterators.stream()
.map(Spliterator::trySplit)
.collect(Collectors.toList());
return split.stream().noneMatch(Objects::isNull)
? new ConcatSpliterator<>(split)
: null;
}
代码示例来源:origin: jenetics/jenetics
@Override
public int characteristics() {
return _spliterators.stream()
.mapToInt(Spliterator::characteristics)
.reduce(0xFFFFFFFF, (i1, i2) -> i1 & i2)
& ~Spliterator.SORTED;
}
代码示例来源:origin: SoftInstigate/restheart
public BsonDocument getProjectionDocument() throws JsonParseException {
final BsonDocument projection = new BsonDocument();
if (keys == null || keys.isEmpty()) {
return null;
} else {
keys.stream().forEach((String f) -> {
projection.putAll(BsonDocument.parse(f)); // this can throw JsonParseException for invalid keys parameters
});
}
return projection;
}
内容来源于网络,如有侵权,请联系作者删除!