Example usage for java.util ArrayList removeIf

List of usage examples for java.util ArrayList removeIf

Introduction

In this page you can find the example usage for java.util ArrayList removeIf.

Prototype

@Override
public boolean removeIf(Predicate<? super E> filter) 

Source Link

Usage

From source file:org.apache.sysml.hops.codegen.opt.PlanAnalyzer.java

private static ArrayList<Long> getMaterializationPoints(HashSet<Long> roots, HashSet<Long> partition,
        CPlanMemoTable memo) {/*from   www .j  av a2 s .  c  o  m*/
    //collect materialization points bottom-up
    ArrayList<Long> ret = new ArrayList<>();
    HashSet<Long> visited = new HashSet<>();
    for (Long hopID : roots)
        rCollectMaterializationPoints(memo.getHopRefs().get(hopID), visited, partition, roots, ret);

    //remove special-case materialization points
    //(root nodes w/ multiple consumers, tsmm input if consumed in partition)
    ret.removeIf(hopID -> roots.contains(hopID) || HopRewriteUtils.isTsmmInput(memo.getHopRefs().get(hopID)));

    if (LOG.isTraceEnabled()) {
        LOG.trace("Partition materialization points: " + Arrays.toString(ret.toArray(new Long[0])));
    }

    return ret;
}

From source file:org.apache.sysml.hops.codegen.template.PlanSelectionFuseCostBased.java

private static ArrayList<Long> getMaterializationPoints(HashSet<Long> roots, HashSet<Long> partition,
        CPlanMemoTable memo) {/*from  www.  jav a 2s  . c  o  m*/
    //collect materialization points bottom-up
    ArrayList<Long> ret = new ArrayList<Long>();
    HashSet<Long> visited = new HashSet<Long>();
    for (Long hopID : roots)
        rCollectMaterializationPoints(memo._hopRefs.get(hopID), visited, partition, ret);

    //remove special-case materialization points
    //(root nodes w/ multiple consumers, tsmm input if consumed in partition)
    ret.removeIf(hopID -> roots.contains(hopID) || HopRewriteUtils.isTsmmInput(memo._hopRefs.get(hopID)));

    return ret;
}