Example usage for org.apache.commons.collections15.iterators FilterIterator FilterIterator

List of usage examples for org.apache.commons.collections15.iterators FilterIterator FilterIterator

Introduction

In this page you can find the example usage for org.apache.commons.collections15.iterators FilterIterator FilterIterator.

Prototype

public FilterIterator(Iterator<E> iterator, Predicate<? super E> predicate) 

Source Link

Document

Constructs a new FilterIterator that will use the given iterator and predicate.

Usage

From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.common.PropertiesSetListingQueryFullTableScan.java

public Iterable<GenericEntityPropertyRecord> getEntityPropertyGenericValues(final LongSet entityIDs) {
    return new Iterable<GenericEntityPropertyRecord>() {
        public Iterator<GenericEntityPropertyRecord> iterator() {
            return new FilterIterator<GenericEntityPropertyRecord>(query.getEntityPropertyGenericValues(),
                    new Predicate<BaseEntityPropertyRecord>() {
                        public boolean evaluate(BaseEntityPropertyRecord baseSample) {
                            return entityIDs.contains(baseSample.entity_id);
                        }//from   w ww  .  j  a v  a 2s .com
                    });
        }
    };
}

From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.SampleSetListingQueryFullTableScan.java

public Iterable<SampleRecord> getSamples(final LongSet sampleIds) {
    return new Iterable<SampleRecord>() {
        public Iterator<SampleRecord> iterator() {
            return new FilterIterator<SampleRecord>(query.getSamples(databaseInstanceId),
                    new Predicate<SampleRecord>() {
                        public boolean evaluate(SampleRecord sample) {
                            return sampleIds.contains(sample.id);
                        }/*w  w w  .  ja  v a  2s.  c o m*/
                    });
        }
    };
}

From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.DatasetSetListingQueryFullTableScan.java

public Iterable<DatasetRecord> getDatasets(final LongSet datasetIds) {
    return new Iterable<DatasetRecord>() {
        public Iterator<DatasetRecord> iterator() {
            return new FilterIterator<DatasetRecord>(query.getDatasets(databaseInstanceId),
                    new Predicate<DatasetRecord>() {
                        public boolean evaluate(DatasetRecord dataset) {
                            return datasetIds.contains(dataset.id);
                        }//from ww w. j av  a  2 s . c o m
                    });
        }
    };
}

From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.common.PropertiesSetListingQueryFullTableScan.java

public Iterable<MaterialEntityPropertyRecord> getEntityPropertyMaterialValues(final LongSet entityIDs) {
    return new Iterable<MaterialEntityPropertyRecord>() {
        public Iterator<MaterialEntityPropertyRecord> iterator() {
            return new FilterIterator<MaterialEntityPropertyRecord>(query.getEntityPropertyMaterialValues(),
                    new Predicate<BaseEntityPropertyRecord>() {
                        public boolean evaluate(BaseEntityPropertyRecord baseSample) {
                            return entityIDs.contains(baseSample.entity_id);
                        }//from  ww w. ja v a 2s .c  o m
                    });
        }
    };
}

From source file:facade.collections.CollectionSafeProxy.java

public CollectionProxy<T> select(Predicate<T> pred) {
    Collection<T> newCollection = null;
    try { //TODO: define a proper exception management
        newCollection = emptyCloneCollection();
    } catch (InstantiationException ex) {
        Logger.getLogger(CollectionSafeProxy.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        Logger.getLogger(CollectionSafeProxy.class.getName()).log(Level.SEVERE, null, ex);
    }/* w w w  . j a va  2 s  . c om*/
    Iterator<T> it = new FilterIterator<T>(collection.iterator(), pred);
    while (it.hasNext()) {
        newCollection.add(it.next());
    }
    return new CollectionInPlaceProxy<T>(newCollection);
}

From source file:ch.systemsx.cisd.openbis.generic.server.business.bo.common.PropertiesSetListingQueryFullTableScan.java

public Iterable<VocabularyTermRecord> getEntityPropertyVocabularyTermValues(final LongSet entityIDs) {
    return new Iterable<VocabularyTermRecord>() {
        public Iterator<VocabularyTermRecord> iterator() {
            return new FilterIterator<VocabularyTermRecord>(query.getEntityPropertyVocabularyTermValues(),
                    new Predicate<BaseEntityPropertyRecord>() {
                        public boolean evaluate(BaseEntityPropertyRecord baseSample) {
                            return entityIDs.contains(baseSample.entity_id);
                        }/*from w w w  .ja  va  2s.c  o  m*/
                    });
        }
    };
}

From source file:org.echocat.jomon.runtime.util.ExtendingHints.java

@Override
public Iterator<Entry<Key<Object>, Object>> iterator() {
    return new FilterIterator<>(concat(super.iterator(), _superHints.iterator()),
            new Predicate<Entry<Key<Object>, Object>>() {
                @Override//w  w w  .  j  av a 2  s  .  com
                public boolean evaluate(Entry<Key<Object>, Object> entry) {
                    // noinspection ObjectEquality
                    return entry != null && entry.getValue() != NULL;
                }
            });
}

From source file:org.eknet.neoswing.loader.DefaultGraphLoaderManager.java

@Override
public Iterable<String> getRegisteredLoaders() {
    return new Iterable<String>() {
        @Override/*from   w w  w  . j  a v a2 s  .  c om*/
        public Iterator<String> iterator() {
            return new FilterIterator<String>(loaders.keySet().iterator(), new Predicate<String>() {
                @Override
                public boolean evaluate(String s) {
                    GraphLoader gl = loaders.get(s);
                    return gl != null && gl.isSupported();
                }
            });
        }
    };
}