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

x33g5p2x  于2022-01-15 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(167)

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

ArrayDeque.stream介绍

暂无

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
public long ramBytesUsed() {
 // Return a rough estimation for allocated blocks. Note that we do not make
 // any special distinction for direct memory buffers.
 return RamUsageEstimator.NUM_BYTES_OBJECT_REF * blocks.size() + 
     blocks.stream().mapToLong(buf -> buf.capacity()).sum();
}

代码示例来源:origin: apache/incubator-druid

private boolean holderListContains(V object)
{
 return resourceHolderList.stream().anyMatch(a -> a.getResource().equals(object));
}

代码示例来源:origin: org.apache.lucene/lucene-core

/**
 * This method resets this object to a clean (zero-size) state and
 * publishes any currently allocated buffers for reuse to the reuse strategy
 * provided in the constructor.
 * 
 * Sharing byte buffers for reads and writes is dangerous and will very likely
 * lead to hard-to-debug issues, use with great care.
 */
public void reset() {
 blocks.stream().forEach(blockReuse);
 blocks.clear();
 currentBlock = EMPTY;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public long ramBytesUsed() {
 // Return a rough estimation for allocated blocks. Note that we do not make
 // any special distinction for direct memory buffers.
 return RamUsageEstimator.NUM_BYTES_OBJECT_REF * blocks.size() + 
     blocks.stream().mapToLong(buf -> buf.capacity()).sum();
}

代码示例来源:origin: fastily/jwiki

/**
 * Find top-level WTemplates contained by this WikiText
 * 
 * @return A List of top-level WTemplates in this WikiText.
 */
public ArrayList<WTemplate> getTemplates()
{
  return FL.toAL(l.stream().filter(o -> o instanceof WTemplate).map(o -> (WTemplate) o));
}

代码示例来源:origin: fastily/jwiki

/**
 * Recursively finds WTemplate objects contained by this WikiText.
 * 
 * @param wtl Any WTemplate objects found will be added to this List.
 * 
 * @see #getTemplatesR()
 */
private void getTemplatesR(ArrayList<WTemplate> wtl)
{
  l.stream().filter(o -> o instanceof WTemplate).map(o -> (WTemplate) o).forEach(t -> {
    for (WikiText wt : t.params.values())
      wt.getTemplatesR(wtl);
    wtl.add(t);
  });
}

代码示例来源:origin: metamx/java-util

private boolean holderListContains(V object)
{
 return resourceHolderList.stream().anyMatch(a -> a.getResource().equals(object));
}

代码示例来源:origin: com.metamx/java-util

private boolean holderListContains(V object)
{
 return resourceHolderList.stream().anyMatch(a -> a.getResource().equals(object));
}

代码示例来源:origin: io.druid/java-util

private boolean holderListContains(V object)
{
 return resourceHolderList.stream().anyMatch(a -> a.getResource().equals(object));
}

代码示例来源:origin: org.apache.druid/java-util

private boolean holderListContains(V object)
{
 return resourceHolderList.stream().anyMatch(a -> a.getResource().equals(object));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * This method resets this object to a clean (zero-size) state and
 * publishes any currently allocated buffers for reuse to the reuse strategy
 * provided in the constructor.
 * 
 * Sharing byte buffers for reads and writes is dangerous and will very likely
 * lead to hard-to-debug issues, use with great care.
 */
public void reset() {
 blocks.stream().forEach(blockReuse);
 blocks.clear();
 currentBlock = EMPTY;
}

代码示例来源:origin: PapenfussLab/gridss

private ArrayDeque<KmerPathSubnode> asUnanchoredPath(TraversalNode tn) {
  if (tn == null) return null;
  ArrayDeque<KmerPathSubnode> contig = tn.toSubnodeNextPath();
  if (contig.peekFirst().isReference()) {
    contig.pollFirst();
  }
  if (contig.peekLast().isReference()) {
    contig.pollLast();
  }
  assert(!contig.isEmpty());
  assert(contig.stream().allMatch(sn -> !sn.isReference()));
  assert(contig.stream().allMatch(sn -> sn.node().isValid()));
  return contig;
}
@Override

代码示例来源:origin: PapenfussLab/gridss

private ArrayDeque<KmerPathSubnode> extendStartingAnchor(ArrayDeque<KmerPathSubnode> contig, int targetAnchorLength) {
  KmerPathNodePath startAnchorPath = new KmerPathNodePath(contig.getLast(), false, targetAnchorLength + maxEvidenceSupportIntervalWidth + contig.stream().mapToInt(sn -> sn.length()).sum());
  Iterator<KmerPathSubnode> it = contig.descendingIterator();
  it.next();
  startAnchorPath.push(it);
  startAnchorPath.greedyTraverse(true, false);
  return startAnchorPath.headNode().asSubnodes();
}
private boolean containsKmerRepeat(Collection<KmerPathSubnode> contig) {

代码示例来源:origin: PapenfussLab/gridss

private ArrayDeque<KmerPathSubnode> extendEndingAnchor(ArrayDeque<KmerPathSubnode> contig, int targetAnchorLength) {
  KmerPathNodePath endAnchorPath = new KmerPathNodePath(contig.getFirst(), true, targetAnchorLength + maxEvidenceSupportIntervalWidth + contig.stream().mapToInt(sn -> sn.length()).sum());
  Iterator<KmerPathSubnode> it = contig.iterator();
  it.next();
  endAnchorPath.push(it);
  endAnchorPath.greedyTraverse(true, false);
  endAnchorPath.headNext();
  return endAnchorPath.headNode().asSubnodes();
}
private ArrayDeque<KmerPathSubnode> extendStartingAnchor(ArrayDeque<KmerPathSubnode> contig, int targetAnchorLength) {

代码示例来源:origin: anba/es6draft

assert stack.stream().filter(m -> m == sourceModule).count() == 1;

代码示例来源:origin: PapenfussLab/gridss

/**
 * Removes partial contigs that are longer than the maximum theoretical breakend contig length
 */
private void removeMisassembledPartialContig() {
  // |<---      maxExpectedBreakendLength            --->|
  //            |<--- maxEvidenceSupportIntervalWidth--->|   
  //                                                  nextPosition
  ArrayDeque<KmerPathSubnode> misassembly = bestContigCaller.frontierPath(nextPosition(), nextPosition() - maxExpectedBreakendLength());
  if (misassembly == null) return;
  // To be sure that all reads on the contig to remove have
  // been fully loaded, we don't remove nodes that could contain
  // a read that also contributed to an unprocessed node
  List<KmerPathSubnode> misassemblyToRemove = misassembly.stream()
    .filter(sn -> sn.lastEnd() + minDistanceFromNextPositionForEvidenceToBeFullyLoaded() < nextPosition())
    .collect(Collectors.toList());
  if (misassemblyToRemove.size() == 0) {
    return;
  }
  Set<KmerEvidence> evidence = evidenceTracker.untrack(misassemblyToRemove);
  removeFromGraph(evidence);
}
private int nextPosition() {

代码示例来源:origin: anba/es6draft

assert stack.stream().filter(m -> m == sourceModule).count() == 1;

代码示例来源:origin: PapenfussLab/gridss

node = removeWeight(replacement, node, index, collection);
  if (Defaults.SANITY_CHECK_ASSEMBLY_GRAPH) {
    assert(replacement.stream().allMatch(n -> n.isValid()));
    if (node != null) {
      assert(node.sanityCheck());
assert(replacement.stream().allMatch(n -> n.isValid()));
replacement.stream().forEach(n -> n.sanityCheck());
int postWeight = replacement.stream().mapToInt(n -> n.weight() * n.width()).sum();
assert(postWeight + deltaWeight == preWeight);
assert(replacement.stream().allMatch(pn -> pn.sanityCheck()));

代码示例来源:origin: PapenfussLab/gridss

int contigLength = contig.stream().mapToInt(sn -> sn.length()).sum();
int targetAnchorLength = Math.max(Math.min(contigLength, maxExpectedBreakendLength()), maxAnchorLength);
ArrayDeque<KmerPathSubnode> fullContig = contig;
byte[] bases = KmerEncodingHelper.baseCalls(fullContig.stream().flatMap(sn -> sn.node().pathKmers().stream()).collect(Collectors.toList()), k);
byte[] quals = DeBruijnGraphBase.kmerWeightsToBaseQuals(k, fullContig.stream().flatMapToInt(sn -> sn.node().pathWeights().stream().mapToInt(Integer::intValue)).toArray());
assert(quals.length == bases.length);
int startAnchorBaseCount = startingAnchor.size() == 0 ? 0 : startingAnchor.stream().mapToInt(n -> n.length()).sum() + k - 1;
int endAnchorBaseCount = endingAnchor.size() == 0 ? 0 : endingAnchor.stream().mapToInt(n -> n.length()).sum() + k - 1;
int startBasesToTrim = Math.max(0, startAnchorBaseCount - targetAnchorLength);
int endingBasesToTrim = Math.max(0, endAnchorBaseCount - targetAnchorLength);

相关文章