List of usage examples for com.google.common.collect Sets filter
@GwtIncompatible("NavigableSet") @SuppressWarnings("unchecked") @CheckReturnValue public static <E> NavigableSet<E> filter(NavigableSet<E> unfiltered, Predicate<? super E> predicate)
From source file:co.cask.cdap.etl.common.PipelinePhase.java
private PipelinePhase getSubset(final Dag subsetDag) { Map<String, Set<StageInfo>> subsetStages = new HashMap<>(); for (Map.Entry<String, Set<StageInfo>> stagesEntry : stages.entrySet()) { final Set<StageInfo> stagesOfType = Sets.filter(stagesEntry.getValue(), new Predicate<StageInfo>() { @Override//from w w w .j a va 2s.co m public boolean apply(StageInfo stageInfo) { return subsetDag.getNodes().contains(stageInfo.getName()); } }); if (!stagesOfType.isEmpty()) { subsetStages.put(stagesEntry.getKey(), stagesOfType); } } return new PipelinePhase(subsetStages, subsetDag); }
From source file:gov.nih.nci.caarray.domain.file.FileTypeRegistryImpl.java
/** * {@inheritDoc}/* w ww. j ava 2 s.co m*/ */ @Override public Set<FileType> getRawArrayDataTypes() { return Sets.filter(this.types, new Predicate<FileType>() { @Override public boolean apply(FileType ft) { return ft.isRawArrayData(); } }); }
From source file:org.caleydo.core.util.color.AlexColorPalette.java
public static Set<AlexColorPalette> getSets(EColorSchemeType type) { return Sets.filter(ImmutableSet.copyOf(values()), type.isOf()); }
From source file:org.apache.cassandra.db.index.sasi.conf.view.View.java
public Set<SSTableIndex> match(final Set<SSTableReader> scope, Expression expression) { return Sets.filter(termTree.search(expression), new Predicate<SSTableIndex>() { @Override//from w w w. j a v a2 s .c o m public boolean apply(SSTableIndex index) { return scope.contains(index.getSSTable()); } }); }
From source file:com.sun.tools.hat.internal.util.Misc.java
public static ImmutableSet<JavaHeapObject> getReferrers(Iterable<JavaHeapObject> instances, Predicate<JavaHeapObject> filter) { ImmutableSet.Builder<JavaHeapObject> builder = ImmutableSet.builder(); for (JavaHeapObject instance : instances) { builder.addAll(Sets.filter(instance.getReferers(), filter)); }/*from ww w . j ava 2 s . co m*/ return builder.build(); }
From source file:com.censoredsoftware.infractions.bukkit.issuer.Issuer.java
/** * Set of Infractions contributed to.// w w w.ja v a 2 s .c om * * @return Infractions. */ public Set<Infraction> getContributedInfractions() { return Sets.filter(Infractions.allInfractions(), new Predicate<Infraction>() { @Override public boolean apply(Infraction infraction) { return Iterables.any(infraction.getEvidence(), new Predicate<Evidence>() { @Override public boolean apply(Evidence evidence) { return getId().equals(evidence.getIssuer().getId()); } }); } }); }
From source file:com.censoredsoftware.infractions.bukkit.origin.Origin.java
/** * Set of all issued/created Infractions from this Origin. * * @return Infractions.//from w w w .j a v a 2 s. c o m */ public Set<Infraction> getInfractions() { final Origin origin = this; return Sets.filter(Infractions.allInfractions(), new Predicate<Infraction>() { @Override public boolean apply(Infraction infraction) { return origin.equals(infraction.getOrigin()); } }); }
From source file:eu.lp0.cursus.scoring.scorer.AbstractScorer.java
@Override public Scores scoreRaces(List<Race> races, Predicate<Pilot> fleetFilter) { Set<Pilot> pilots = new HashSet<Pilot>(); for (Race race : races) { pilots.addAll(race.getAttendees().keySet()); }// w w w. ja va 2 s . co m return scoreRaces(races, Sets.filter(pilots, fleetFilter), fleetFilter); }
From source file:org.fenixedu.qubdocs.academic.documentRequests.providers.CurriculumEntryRemarksDataProvider.java
public Set<RemarkEntry> getRemarkEntriesFor(final CurriculumEntry curriculumEntry) { return Sets.filter(entries, new Predicate<RemarkEntry>() { @Override/*ww w.j a v a 2 s . c om*/ public boolean apply(final RemarkEntry remarkEntry) { return remarkEntry.curriculumEntries.contains(curriculumEntry); } }); }
From source file:org.grouplens.lenskit.core.GraphtUtils.java
/** * Remove transient edges from a set./*w ww .ja va 2 s . c o m*/ * * @param edges The set of edges. * @return A new set containing only the non-transient edges. */ public static Set<Edge> removeTransient(Set<Edge> edges) { return Sets.filter(edges, new Predicate<Edge>() { @Override public boolean apply(@Nullable Edge input) { Desire desire = input == null ? null : input.getDesire(); return desire == null || !desireIsTransient(desire); } }); }