Example usage for com.google.common.base Predicates notNull

List of usage examples for com.google.common.base Predicates notNull

Introduction

In this page you can find the example usage for com.google.common.base Predicates notNull.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> notNull() 

Source Link

Document

Returns a predicate that evaluates to true if the object reference being tested is not null.

Usage

From source file:edu.harvard.med.screensaver.model.libraries.LibraryPlate.java

public LibraryPlate(Integer plateNumber, Library library, Set<AssayPlate> assayPlates) {
    super(plateNumber);

    _library = library;//  w ww  .ja  v a 2  s.  c  o m
    _assayPlateCount = assayPlates.size();
    Iterable<AssayPlate> assayPlatesUniqueAttempts = Iterables.filter(assayPlates, AssayPlate.IsFirstReplicate);
    _copiesScreened = Sets
            .newTreeSet(Iterables.transform(Iterables.filter(assayPlates, AssayPlate.HasLibraryScreening),
                    Functions.compose(Plate.ToCopy, AssayPlate.ToPlate)));
    _libraryScreenings = Sets.newTreeSet(
            Iterables.filter(Iterables.transform(assayPlatesUniqueAttempts, AssayPlate.ToLibraryScreening),
                    Predicates.notNull()));
    if (!_libraryScreenings.isEmpty()) {
        _firstDateScreened = _libraryScreenings.first().getDateOfActivity();
        _lastDateScreened = _libraryScreenings.last().getDateOfActivity();
    }
    SortedSet<AdministrativeActivity> dataLoadings = Sets.newTreeSet(Iterables.filter(
            Iterables.transform(assayPlatesUniqueAttempts, AssayPlate.ToScreenResultDataLoading),
            Predicates.notNull()));
    _dataLoadingCount = dataLoadings.size();
    if (_dataLoadingCount > 0) {
        _firstDateDataLoaded = dataLoadings.first().getDateOfActivity();
        _lastDateDataLoaded = dataLoadings.last().getDateOfActivity();
    }
}

From source file:org.jclouds.openstack.keystone.v2_0.binders.BindAuthToJsonPayload.java

protected void addCredentialsInArgsOrNull(GeneratedHttpRequest gRequest, Builder<String, Object> builder) {
    for (Object arg : Iterables.filter(gRequest.getInvocation().getArgs(), Predicates.notNull())) {
        if (arg.getClass().isAnnotationPresent(CredentialType.class)) {
            builder.put(arg.getClass().getAnnotation(CredentialType.class).value(), arg);
        }//from   ww w  .j  a v a2  s  . c o  m
    }
}

From source file:org.jclouds.cloudsigma.functions.SplitNewlinesAndReturnSecondField.java

@Override
public Set<String> apply(HttpResponse response) {
    return ImmutableSet
            .copyOf(Iterables.filter(Iterables.transform(super.apply(response), new Function<String, String>() {

                @Override//from  ww  w  . j  av  a2s.c  om
                public String apply(String arg0) {
                    if (arg0 == null)
                        return null;
                    Iterable<String> parts = Splitter.on(' ').split(arg0);
                    if (Iterables.size(parts) == 2)
                        return Iterables.get(parts, 1);
                    else if (Iterables.size(parts) == 1)
                        return Iterables.get(parts, 0);
                    return null;
                }

            }), Predicates.notNull()));
}

From source file:com.ebay.pulsar.analytics.datasource.AbstractDataSourceProviderFactory.java

@Override
public DataSourceProvider create(DataSourceConfiguration configuration) {
    DataSourceProvider dataSourceProvider = new DataSourceProvider();
    dataSourceProvider.setDataSourceName(configuration.getDataSourceName());
    final DBConnector client = getDBCollector(configuration);

    Set<String> tableNames = client.getAllTables();

    List<Table> allTables = Lists
            .newArrayList(FluentIterable.from(tableNames).transform(new Function<String, Table>() {
                @Override//from  ww  w  . java2  s . c  o m
                public Table apply(String input) {
                    return client.getTableMeta(input);
                }
            }).filter(Predicates.notNull()));

    dataSourceProvider.setTables(allTables);
    dataSourceProvider.setConnector(client);
    return dataSourceProvider;
}

From source file:de.metas.ui.web.handlingunits.report.HUEditorRowAsHUToReport.java

@Override
public List<HUToReport> getIncludedHUs() {
    return row.getIncludedRows().stream().map(HUEditorRow::getAsHUToReportOrNull).filter(Predicates.notNull())
            .collect(ImmutableList.toImmutableList());
}

From source file:gg.uhc.uhc.modules.WorldMatcher.java

public WorldMatcher(ConfigurationSection section, List<String> worldsDefault, boolean isWhitelistDefault) {
    if (!section.contains(WORLDS_KEY)) {
        section.set(WORLDS_KEY, worldsDefault);
    }//w  w w .ja  v a2  s.  c o  m

    if (!section.contains(IS_WHITELIST_KEY)) {
        section.set(IS_WHITELIST_KEY, isWhitelistDefault);
    }

    worlds = ImmutableSet.copyOf(Iterables.filter(
            Iterables.transform(section.getStringList(WORLDS_KEY), TO_LOWER_CASE), Predicates.notNull()));
    isWhitelist = section.getBoolean(IS_WHITELIST_KEY);
}

From source file:com.tinspx.util.collect.NotNull.java

/**
 * Wraps {@code multiset} as a {@code Multiset} that doe not allow
 * {@code null} elements to be added.//  ww  w  .  j av a  2  s.  c  o m
 *
 * @throws NullPointerException if any existing element in {@code multiset}
 * is {@code null}
 */
public static <E> Multiset<E> multiset(Multiset<E> multiset) {
    CollectUtils.checkAllNotNull(multiset.elementSet());
    return Predicated.multiset(multiset, Predicates.notNull());
}

From source file:org.polarsys.reqcycle.traceability.builder.impl.ExtensionPointReader.java

public Set<IBuildingDecoration> read() {
    IConfigurationElement[] elements = Platform.getExtensionRegistry()
            .getConfigurationElementsFor(Activator.PLUGIN_ID, EXT_ID);
    return Sets.newHashSet(filter(
            transform(Arrays.asList(elements), new Function<IConfigurationElement, IBuildingDecoration>() {

                @Override//from www . j  a va 2s . c  o  m
                public IBuildingDecoration apply(IConfigurationElement arg0) {
                    try {
                        IBuildingDecoration createExecutableExtension = (IBuildingDecoration) arg0
                                .createExecutableExtension("decorate");
                        ZigguratInject.inject(createExecutableExtension);
                        return createExecutableExtension;
                    } catch (CoreException e) {
                        e.printStackTrace();
                    }
                    return null;
                }

            }), Predicates.notNull()));
}

From source file:org.gradle.internal.resource.transport.aws.s3.S3ResourceResolver.java

private List<String> resolveFileResourceNames(ObjectListing objectListing) {
    List<S3ObjectSummary> objectSummaries = objectListing.getObjectSummaries();
    if (null != objectSummaries) {
        return ImmutableList.copyOf(Iterables.filter(Iterables.transform(objectSummaries, EXTRACT_FILE_NAME),
                Predicates.notNull()));
    }/*from  w  w w  . jav  a  2  s  .c o m*/
    return Collections.emptyList();

}

From source file:com.gwtplatform.dispatch.rest.processors.resource.ResourceUtils.java

public List<ResourceMethod> processMethods(TypeElement element, final Resource resourceType) {
    List<Element> members = utils.getAllMembers(element, Object.class);
    List<ExecutableElement> methods = methodsIn(members);

    return FluentIterable.from(methods)
            .transform(element1 -> resourceMethodFactories.create(resourceType, element1))
            .filter(Predicates.notNull()).toList();
}