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:eu.lp0.cursus.xml.data.entity.DataXMLEvent.java
public DataXMLEvent(Event event, Set<Race> races, Set<Pilot> pilots) { super(event); name = event.getName();// w w w .ja va 2 s .c o m description = event.getDescription(); if (!event.getAttendees().isEmpty()) { attendees = new ArrayList<DataXMLEventAttendee>(event.getAttendees().size()); for (Pilot pilot : Sets.filter(event.getAttendees(), Predicates.in(pilots))) { attendees.add(new DataXMLEventAttendee(pilot)); } Collections.sort(attendees); } this.races = new ArrayList<DataXMLRace>(races.size()); for (Race race : races) { this.races.add(new DataXMLRace(race, pilots)); } }
From source file:com.strandls.alchemy.webservices.testbase.AlchemyTestWebApplication.java
@Override public Set<Class<?>> getClasses() { final Reflections reflection = new Reflections("com.strandls.alchemy"); return Sets.filter(reflection.getTypesAnnotatedWith(Path.class), new Predicate<Class<?>>() { @Override/* w w w . j a va 2 s . c o m*/ public boolean apply(final Class<?> input) { // ignore client stubs return !input.getName().toLowerCase().contains("client"); } }); }
From source file:org.icgc.dcc.submission.validation.primary.visitor.RowBasedRestrictionPlanningVisitor.java
public RowBasedRestrictionPlanningVisitor(Set<RestrictionType> restrictionTypes) { this.restrictionTypes = Sets.filter(restrictionTypes, new Predicate<RestrictionType>() { @Override// www.j av a 2 s .c om public boolean apply(RestrictionType input) { return input.flowType() == FlowType.ROW_BASED; } }); }
From source file:eu.lp0.cursus.scoring.scorer.AbstractScorer.java
@Override public Scores scoreEvent(Event event, Predicate<Pilot> fleetFilter) { return scoreRaces(event.getRaces(), Sets.filter(event.getAllPilots(), fleetFilter), fleetFilter); }
From source file:eu.interedition.collatex.jung.JungVariantGraphVertex.java
@Override public Set<Token> tokens(final Set<Witness> witnesses) { return Collections.unmodifiableSet( Sets.filter(tokens, witnesses == null ? Predicates.<Token>alwaysTrue() : new Predicate<Token>() { @Override//from w ww . j a v a 2 s. c o m public boolean apply(@Nullable Token token) { return witnesses.contains(token.getWitness()); } })); }
From source file:com.google.enterprise.connector.pusher.AclUserGroupRolesFilter.java
@Override public Set<String> getPropertyNames(Document source) throws RepositoryException { return Sets.filter(source.getPropertyNames(), rolesPredicate); }
From source file:com.ibm.vicos.common.util.ClientIdentityLoader.java
public ConcurrentMap<ClientIdentifier, PublicKey> loadPublicKeyDirectory(final Config config) { ConcurrentMap<ClientIdentifier, PublicKey> publicKeyDirectory = new ConcurrentHashMap<>(); // filter public keys Set<Map.Entry<String, ConfigValue>> publics = Sets.filter(config.entrySet(), input -> input != null && input.getKey().endsWith(".public")); // create a SimpleClientIdentifier for each public key for (Map.Entry<String, ConfigValue> p : publics) { try {/* ww w . j a va2 s .co m*/ String aClientID = CharMatcher.anyOf(".public").trimTrailingFrom(p.getKey()); String somePubKeyData = String.valueOf(p.getValue().unwrapped()); LOG.debug("read public key for {}", aClientID); PublicKey publicKey = cryptoUtils.convert2PublicKey(somePubKeyData); publicKeyDirectory.put( ClientIdentifier.builder().setClientId(aClientID).setPublicKey(publicKey).build(), publicKey); } catch (Exception e) { LOG.error("Can not create public", e); return null; } } return publicKeyDirectory; }
From source file:org.n52.iceland.util.activation.Activatables.java
public static <K, T> Set<K> deactivatedKeys(Map<K, T> map, ActivationProvider<? super K> provider) { return Sets.filter(map.keySet(), Predicates.not(asPredicate(provider))); }
From source file:com.beligum.core.repositories.UserRepository.java
public static User findByEmail(final String email) throws PersistenceException { try {/*from w ww. ja va 2 s . c o m*/ ArrayList<User> userArrayList = newArrayList(Sets.filter(users, new Predicate<User>() { @Override public boolean apply(User user) { return user.getEmail().equals(email); } })); return userArrayList.size() == 1 ? userArrayList.get(0) : null; } catch (Exception e) { Logger.error("Caught error while searching a user by login", e); throw new PersistenceException(e); } }
From source file:org.gradle.api.reporting.dependents.internal.DependentComponentsGraphRenderer.java
private Set<? extends RenderableDependency> getChildren(RenderableDependency node) { return Sets.filter(node.getChildren(), showDependentPredicate); }