List of usage examples for com.google.common.collect Iterables filter
@GwtIncompatible("Class.isInstance") @CheckReturnValue public static <T> Iterable<T> filter(final Iterable<?> unfiltered, final Class<T> desiredType)
From source file:org.summer.dsl.model.types.impl.JvmGenericTypeImplCustom.java
@Override public Iterable<JvmTypeReference> getExtendedInterfaces() { if (extendedInterfaces == null) { extendedInterfaces = Iterables.filter(getSuperTypes(), new Predicate<JvmTypeReference>() { public boolean apply(JvmTypeReference typeReference) { JvmType type = typeReference.getType(); if (type instanceof JvmGenericType) { return ((JvmGenericType) type).isInterface(); }// w w w .ja v a2 s. c o m return false; } }); } return extendedInterfaces; }
From source file:org.splevo.jamopp.refactoring.java.caslicensehandler.cheatsheet.actions.JaMoPPRoutines.java
/** * Returns the concrete classifier (JaMoPP) for the given type (JavaCore). * /*from ww w . j a va 2s. co m*/ * @param type * represents the type. * @return the matched classifier. */ public static Optional<ConcreteClassifier> getConcreteClassifierOf(IType type) { ResourceSet resourceSet = ((JaMoPPJavaSoftwareElement) CASLicenseHandlerConfiguration.getInstance() .getVariationPoint().getLocation()).getJamoppElement().eResource().getResourceSet(); final String typeName = type.getElementName(); URI resourceURI = URI.createPlatformResourceURI(type.getResource().getFullPath().toString(), true); Resource r = resourceSet.getResource(resourceURI, true); for (CompilationUnit cu : Iterables.filter(r.getContents(), CompilationUnit.class)) { LinkedList<ConcreteClassifier> queue = Lists.newLinkedList(cu.getClassifiers()); while (!queue.isEmpty()) { ConcreteClassifier classifier = queue.pop(); if (typeName.equals(classifier.getName())) { return Optional.of(classifier); } } } return Optional.absent(); }
From source file:com.google.eclipse.mechanic.core.keybinding.KeyBindingsModel.java
private static ImmutableList<KbaChangeSet> filteredChangeSetList(List<KbaChangeSet> changeSetList) { Predicate<KbaChangeSet> filterOutRemoveActions = new Predicate<KbaChangeSet>() { public boolean apply(KbaChangeSet source) { // TODO: support remove if (KeyboardBindingsTask.ENABLE_EXP_REM()) { return true; }/* ww w .j a va 2 s . co m*/ return source.getAction() == Action.ADD; } }; return ImmutableList.copyOf(Iterables.filter(changeSetList, filterOutRemoveActions)); }
From source file:com.isotrol.impe3.pms.core.support.PortalPages.java
public static PortalPages of(final PortalDfn portal, final UUID deviceId) { Iterable<PageDfn> pages = portal.getPages(); if (deviceId != null) { final Predicate<PageDfn> ofDevice = new Predicate<PageDfn>() { public boolean apply(PageDfn input) { return deviceId.equals(input.getPage().getDevice().getId()); }/*from w w w . j av a2 s . c om*/ }; pages = Iterables.filter(pages, ofDevice); } return new PortalPages(pages); }
From source file:com.android.builder.internal.aapt.AaptUtils.java
/** * Obtains resource configs that are not densities. * * @return resource configs that are not recognized as densities as per * {@link Density#getEnum(String)}//from www . ja v a2s .com */ public static Iterable<String> getNonDensityResConfigs(@NonNull Iterable<String> configs) { return Iterables.filter(configs, Predicates.not(IS_DENSITY)); }
From source file:org.apache.druid.query.filter.DimFilters.java
public static List<DimFilter> filterNulls(List<DimFilter> optimized) { return Lists.newArrayList(Iterables.filter(optimized, Predicates.notNull())); }
From source file:org.asoem.greyfish.utils.collect.AbstractFunctionalList.java
@Override public Iterable<E> filter(final Predicate<? super E> predicate) { return Iterables.filter(this, predicate); }
From source file:eu.itesla_project.iidm.network.impl.ConnectedComponentImpl.java
@Override public Iterable<Bus> getBuses() { return Iterables.filter(networkRef.get().getBusView().getBuses(), new Predicate<Bus>() { @Override//from w ww. jav a 2s . co m public boolean apply(Bus bus) { return bus.getConnectedComponent() == ConnectedComponentImpl.this; } }); }
From source file:com.yahoo.yqlplus.engine.internal.plan.types.base.StructBase.java
@Override public final Iterable<String> getFieldNames() { return Iterables.filter(getAllFieldNames(), IS_SET); }
From source file:org.polarsys.reqcycle.export.transform.FilteredReqProvider.java
@Override public Iterable<Requirement> getRequirements() { return Iterables.filter(provider.getRequirements(), new Predicate<Requirement>() { @Override/* w w w .j a v a 2 s . co m*/ public boolean apply(Requirement arg0) { return predicate.match(arg0); } }); }