List of usage examples for com.google.common.base Predicates notNull
@GwtCompatible(serializable = true) public static <T> Predicate<T> notNull()
From source file:org.opensaml.saml.metadata.resolver.filter.impl.EntityAttributesFilter.java
/** * Set the mappings from {@link Predicate} to {@link Attribute} collection to apply. * //from ww w .j a va2 s .c o m * @param rules rules to apply */ public void setRules( @Nonnull @NonnullElements final Map<Predicate<EntityDescriptor>, Collection<Attribute>> rules) { Constraint.isNotNull(rules, "Rules map cannot be null"); applyMap = ArrayListMultimap.create(rules.size(), 1); for (final Map.Entry<Predicate<EntityDescriptor>, Collection<Attribute>> entry : rules.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { applyMap.putAll(entry.getKey(), Collections2.filter(entry.getValue(), Predicates.notNull())); } } }
From source file:net.shibboleth.idp.relyingparty.impl.ConditionalRelyingPartyConfigurationResolver.java
/** * Set the registered relying party configurations. * /*from w w w . j av a 2s . c om*/ * This property may not be changed after the resolver is initialized. * * @param configs list of registered relying party configurations */ public void setRelyingPartyConfigurations( @Nonnull @NonnullElements final Collection<ConditionalRelyingPartyConfiguration> configs) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isNotNull(configs, "RelyingPartyConfiguration collection cannot be null"); rpConfigurations = Lists.newArrayList(Collections2.filter(configs, Predicates.notNull())); }
From source file:fr.javatronic.damapping.intellij.plugin.integration.psiparsing.impl.PsiParsingServiceImpl.java
private static List<DAEnumValue> extractEnumValues(PsiClass psiClass) { return from(Arrays.asList(psiClass.getChildren())).filter(PsiEnumConstant.class) .transform(PsiEnumConstantDAEnumValue.INSTANCE).filter(Predicates.notNull()).toImmutableList(); }
From source file:de.metas.ui.web.pickingV2.packageable.PackageableRow.java
private static LocalDate calculateEarliestDeliveryDate(final Collection<Packageable> packageables) { return packageables.stream().map(Packageable::getDeliveryDate).filter(Predicates.notNull()) .map(LocalDateTime::toLocalDate).min(LocalDate::compareTo).orElse(null); }
From source file:de.metas.ui.web.window.model.lookup.LookupCacheInvalidationDispatcher.java
private Set<String> extractTableNames(final CacheInvalidateMultiRequest multiRequest) { if (multiRequest.isResetAll()) { // not relevant for our lookups return ImmutableSet.of(); }// w w w .j a va2 s . c om return multiRequest.getRequests().stream().filter(request -> !request.isAll()) // not relevant for our lookups .map(CacheInvalidateRequest::getTableNameEffective).filter(Predicates.notNull()) .collect(ImmutableSet.toImmutableSet()); }
From source file:org.atlasapi.AtlasModule.java
private List<ServerAddress> mongoHosts() { Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults(); return ImmutableList.copyOf(Iterables .filter(Iterables.transform(splitter.split(mongoHost), new Function<String, ServerAddress>() { @Override//from w w w. ja v a 2s . c o m public ServerAddress apply(String input) { try { return new ServerAddress(input, 27017); } catch (UnknownHostException e) { return null; } } }), Predicates.notNull())); }
From source file:org.splevo.jamopp.vpm.analyzer.semantic.JaMoPPSemanticContentProviderSwitch.java
private Iterable<String> doInternalSwitch(Iterable<? extends Commentable> elements) { return Iterables.concat( Iterables.filter(Iterables.transform(elements, new Function<Commentable, Iterable<String>>() { @Override//from ww w .jav a2s . c o m public Iterable<String> apply(Commentable input) { return doSwitch(input); } }), Predicates.notNull())); }
From source file:org.apache.cassandra.db.compaction.LazilyCompactedRow.java
public LazilyCompactedRow(CompactionController controller, List<? extends OnDiskAtomIterator> rows) { super(rows.get(0).getKey()); this.rows = rows; this.controller = controller; indexer = controller.cfs.indexManager.gcUpdaterFor(key); // Combine top-level tombstones, keeping the one with the highest markedForDeleteAt timestamp. This may be // purged (depending on gcBefore), but we need to remember it to properly delete columns during the merge maxRowTombstone = DeletionTime.LIVE; for (OnDiskAtomIterator row : rows) { DeletionTime rowTombstone = row.getColumnFamily().deletionInfo().getTopLevelDeletion(); if (maxRowTombstone.compareTo(rowTombstone) < 0) maxRowTombstone = rowTombstone; }//w w w .j ava2 s . co m emptyColumnFamily = ArrayBackedSortedColumns.factory.create(controller.cfs.metadata); emptyColumnFamily.delete(maxRowTombstone); if (!maxRowTombstone.isLive() && maxRowTombstone.markedForDeleteAt < getMaxPurgeableTimestamp()) emptyColumnFamily.purgeTombstones(controller.gcBefore); reducer = new Reducer(); merger = Iterators.filter( MergeIterator.get(rows, emptyColumnFamily.getComparator().onDiskAtomComparator(), reducer), Predicates.notNull()); }
From source file:org.gradle.model.internal.inspect.ModelRuleSourceDetector.java
public Iterable<Class<? extends RuleSource>> getDeclaredSources(Class<?> container) { try {//from w ww . j a v a 2 s .co m return FluentIterable.from(cache.get(container)) .transform(new Function<Reference<Class<? extends RuleSource>>, Class<? extends RuleSource>>() { @Override public Class<? extends RuleSource> apply(Reference<Class<? extends RuleSource>> input) { return input.get(); } }).filter(Predicates.notNull()); } catch (ExecutionException e) { throw UncheckedException.throwAsUncheckedException(e); } }
From source file:org.opensaml.messaging.handler.impl.MessageHandlerErrorStrategyAdapter.java
/** * Constructor.//from w w w . j ava2 s .co m * * @param messageHandler the wrapped message handler * @param typedErrorHandlers the list of typed error handlers to apply */ public MessageHandlerErrorStrategyAdapter(@Nonnull final MessageHandler<MessageType> messageHandler, @Nonnull final List<TypedMessageErrorHandler> typedErrorHandlers) { wrappedHandler = Constraint.isNotNull(messageHandler, "Wrapped MessageHandler cannot be null"); errorHandlers = new ArrayList<>(Collections2.filter( Constraint.isNotNull(typedErrorHandlers, "List of TypedMessageErroHandlers cannot be null"), Predicates.notNull())); rethrowIfHandled = false; rethrowIfNotHandled = true; }