Example usage for com.google.common.collect Iterables filter

List of usage examples for com.google.common.collect Iterables filter

Introduction

In this page you can find the example usage for com.google.common.collect Iterables filter.

Prototype

@GwtIncompatible("Class.isInstance")
@CheckReturnValue
public static <T> Iterable<T> filter(final Iterable<?> unfiltered, final Class<T> desiredType) 

Source Link

Document

Returns all elements in unfiltered that are of the type desiredType .

Usage

From source file:org.sonar.batch.issue.DefaultProjectIssues.java

@Override
public Iterable<Issue> issues() {
    return Iterables.transform(Iterables.filter(cache.all(), new ResolvedPredicate(false)),
            new IssueTransformer());
}

From source file:xml.entity.mutableelement.InternalElement.java

@Override
public String value() {
    final String value = Joiner.on("").join(Iterables.filter(this.children, Elements.byName("#text")));
    return "".equals(value) ? null : value;
}

From source file:org.zeroturnaround.jenkins.reporter.model.JenkinsView.java

public Collection<Job> getFailedJobs() {
    return Lists.newArrayList(Iterables.filter(getJobs(), new BadJobPredicate()));
}

From source file:org.polarsys.reqcycle.traceability.types.RelationUtils.java

/**
 * Return the relations contained in the current configuration
 * /*  w w  w . j  a va2 s  . c o  m*/
 * @param incomings
 * @return
 */
private static List<Relation> filter(EList<Relation> incomings, final Configuration config) {
    return Lists.newArrayList(Iterables.filter(incomings, new Predicate<Relation>() {
        public boolean apply(Relation r) {
            return r.eContainer() == config;
        }
    }));
}

From source file:org.polarsys.reqcycle.types.ui.providers.IterableOfTypesContentProvider.java

@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    tree.clear();/* www  .j  ava  2s .co  m*/
    roots.clear();
    if (newInput instanceof Iterable) {
        Iterable it = (Iterable) newInput;
        Iterable<IType> types = Iterables.filter(it, IType.class);
        Set<IType> aSet = Sets.newHashSet(types);
        for (IType t : types) {
            IType aSuperType = getASuperType(aSet, t);
            if (aSuperType != null) {
                tree.put(aSuperType, t);
            } else {
                roots.add(t);
            }
        }
    }

}

From source file:org.polarsys.reqcycle.types.impl.ExtensionPointReader.java

public Map<String, IType> read() {
    return Maps.uniqueIndex(Iterables.filter(Iterables.transform(
            Arrays.asList(/*from  ww w .j a  v a  2s.com*/
                    Platform.getExtensionRegistry().getConfigurationElementsFor(Activator.PLUGIN_ID, EXT_ID)),
            new Conf2Type()), Predicates.notNull()), new Function<IType, String>() {
                public String apply(IType type) {
                    return type != null ? type.getId() : "";
                }
            });
}

From source file:org.eclipse.xtext.scoping.impl.FilteringScope.java

@Override
public Iterable<IEObjectDescription> getElements(EObject object) {
    return Iterables.filter(delegate.getElements(object), filter);
}

From source file:fr.obeo.dsl.designer.documentation.generator.internal.extensions.RendererRegistry.java

public Iterable<IDocumentationRendererDescriptor> getRenderers(
        final IDocumentationGeneratorDescriptor genDesc) {
    return Iterables.filter(renderers.values(), new Predicate<IDocumentationRendererDescriptor>() {

        @Override// ww w . j  a  va2  s  . c  o m
        public boolean apply(IDocumentationRendererDescriptor arg0) {
            return arg0.appliesOn(genDesc);
        }
    });
}

From source file:org.janusgraph.graphdb.transaction.indexcache.SimpleIndexCache.java

@Override
public Iterable<JanusGraphVertexProperty> get(final Object value, final PropertyKey key) {
    return Iterables.filter(map.get(value), new Predicate<JanusGraphVertexProperty>() {
        @Override// w w  w  . j  av a2 s .c o m
        public boolean apply(@Nullable JanusGraphVertexProperty janusgraphProperty) {
            return janusgraphProperty.propertyKey().equals(key);
        }
    });
}

From source file:net.hillsdon.reviki.configuration.PropertiesPerWikiConfiguration.java

public List<File> getOtherSearchIndexDirectories() {
    Iterable<WikiConfiguration> otherWikis = Iterables.filter(_deploymentConfiguration.getWikis(),
            Predicates.not(Predicates.<WikiConfiguration>equalTo(this)));
    return Lists.newArrayList(Iterables.transform(otherWikis, WikiConfiguration.TO_SEARCH_INDEX_DIR));
}