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

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

Introduction

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

Prototype

@GwtIncompatible("NavigableSet")
@SuppressWarnings("unchecked")
@CheckReturnValue
public static <E> NavigableSet<E> filter(NavigableSet<E> unfiltered, Predicate<? super E> predicate) 

Source Link

Document

Returns the elements of a NavigableSet , unfiltered , that satisfy a predicate.

Usage

From source file:com.takin.mvc.mvc.internal.ControllerInfo.java

public List<ActionInfo> analyze() {
    List<ActionInfo> actions = Lists.newArrayList();

    Set<Method> sets = Sets.filter(Sets.newHashSet(clazz.getDeclaredMethods()), methodFilter);
    PathInfo pathInfo;//from  ww  w.j a va 2s  . c  om
    for (int i = 0; i < pathUrl.length; i++) {
        pathInfo = new PathInfo();
        pathInfo.setTypeAnn(path);
        pathInfo.setTypePath(pathUrl[i]);
        if (path == null)
            pathInfo.setTypeOrder(1000);
        else
            pathInfo.setTypeOrder(path.order());
        for (Method method : sets) {
            Path pathAnnotation = AnnotationUtils.findAnnotation(method, Path.class);
            String[] methodpaths = pathAnnotation.value();
            int order = pathAnnotation.order();

            for (int j = 0; j < methodpaths.length; j++) {
                pathInfo.setMethodAnn(pathAnnotation);
                pathInfo.setMethodPath(methodpaths[j]);
                pathInfo.setMethodOrder(order);
                ActionInfo actionInfo = new ActionInfo(this, method, InitHelper.instance, pathInfo);
                actions.add(actionInfo);
            }
        }
    }

    return actions;

}

From source file:eu.lp0.cursus.scoring.scorer.AbstractScorer.java

@Override
public Scores scoreRace(Race race, Predicate<Pilot> fleetFilter) {
    return scoreRace(race, Sets.filter(race.getAttendees().keySet(), fleetFilter), fleetFilter);
}

From source file:com.dangdang.ddframe.job.cloud.scheduler.ha.ReconcileScheduledService.java

private Set<TaskContext> filterRunningTask() {
    return Sets.filter(facadeService.getAllRunningDaemonTask(), new Predicate<TaskContext>() {
        @Override//from  w w w  . ja  v a  2 s .c om
        public boolean apply(final TaskContext input) {
            return input.getUpdatedTime() < latestFetchRemainingMilliSeconds;
        }
    });
}

From source file:gov.nih.nci.caarray.domain.file.FileTypeRegistryImpl.java

/**
 * {@inheritDoc}/*w w  w .  j  a  v  a 2  s  . co  m*/
 */
@Override
public Set<FileType> getArrayDesignTypes() {
    return Sets.filter(this.types, new Predicate<FileType>() {
        @Override
        public boolean apply(FileType ft) {
            return ft.isArrayDesign();
        }
    });
}

From source file:org.javersion.reflect.AbstractTypeDescriptor.java

public Set<Class<?>> getSuperClasses() {
    return Sets.filter(getAllClasses(), not(isInterface));
}

From source file:org.apache.provisionr.cloudstack.core.VirtualMachines.java

private static VirtualMachine getVirtualMachineByName(CloudStackClient client, final String vmName) {
    Set<VirtualMachine> machines = Sets.filter(client.getVirtualMachineClient().listVirtualMachines(
            ListVirtualMachinesOptions.Builder.name(vmName)), new Predicate<VirtualMachine>() {
                @Override//w w w. jav a2 s.  c  o m
                public boolean apply(VirtualMachine input) {
                    return input != null && vmName.equals(input.getDisplayName());
                }
            });
    return Iterables.getOnlyElement(machines);
}

From source file:org.javersion.reflect.AbstractTypeDescriptor.java

public Set<Class<?>> getInterfaces() {
    return Sets.filter(getAllClasses(), isInterface);
}

From source file:org.opendaylight.yangtools.yang.model.api.SchemaContext.java

/**
 *
 * Returns module instance (from the context) with concrete namespace.
 *
 * @param namespace/*from   ww  w  . ja  v a2s  .  c  o  m*/
 *            URI instance with specified namespace
 * @return module instance which has namespace equal to the
 *         <code>namespace</code> or <code>null</code> in other cases
 */
default Set<Module> findModuleByNamespace(final URI namespace) {
    return Sets.filter(getModules(), m -> namespace.equals(m.getNamespace()));
}

From source file:org.eiichiro.gig.GigListener.java

/**
 * Installs service component classes to the Jaguar container from the 
 * {@link Module} which the {@code Configuration#module()} returns.
 * //  www.ja va  2 s .c  o m
 * @param context {@code ServletContext}.
 */
@Override
protected void install(ServletContext context) {
    Jaguar.install(Sets.filter(configuration.module().components(), new Predicate<Class<?>>() {

        @Override
        public boolean apply(Class<?> clazz) {
            return (!clazz.isInterface() && !Modifier.isAbstract(clazz.getModifiers()));
        }

    }));
}

From source file:com.censoredsoftware.infractions.bukkit.issuer.Issuer.java

/**
 * Set of Issued Evidence.// w  w w.  j  a  va2 s.  com
 *
 * @return Evidence.
 */
public Set<Evidence> getIssuedEvidence() {
    return Sets.filter(Infractions.allEvidence(), new Predicate<Evidence>() {
        @Override
        public boolean apply(Evidence evidence) {
            return getId().equals(evidence.getIssuer().getId());
        }
    });
}