List of usage examples for com.google.common.base Predicates notNull
@GwtCompatible(serializable = true) public static <T> Predicate<T> notNull()
From source file:sg.atom.utils._beta.functional.FunctionalIterator.java
public <RetType> FunctionalIterator<RetType> keep(Function<T, RetType> fn) { return new FunctionalIterator<RetType>( Iterators.filter(Iterators.transform(delegate, fn), Predicates.notNull())); }
From source file:com.google.cloud.tools.intellij.appengine.project.DefaultAppEngineAssetProvider.java
@Nullable @Override/*from w ww . j av a 2 s. co m*/ public XmlFile loadAppEngineStandardWebXml(@NotNull Project project, @NotNull Collection<Module> modules) { List<VirtualFile> appEngineWebXmls = new ArrayList<>(); for (Module module : modules) { appEngineWebXmls.addAll(FilenameIndex.getVirtualFilesByName(project, "appengine-web.xml", module.getModuleContentScope())); } Iterables.filter(appEngineWebXmls, Predicates.notNull()); if (appEngineWebXmls.size() > 1) { // Prefer the appengine-web.xml located under the WEB-INF directory Collections.sort(appEngineWebXmls, new AppEngineWebXmlOrdering()); logger.warn("The following appengine-web.xml's were found: " + appEngineWebXmls + "\nThe first one in the list will be used."); } if (!appEngineWebXmls.isEmpty()) { VirtualFile appEngineWebXml = appEngineWebXmls.iterator().next(); return (XmlFile) PsiManager.getInstance(project).findFile(appEngineWebXml); } return null; }
From source file:com.mycila.ujd.impl.DefaultJVM.java
public Iterable<? extends Loader> getLoaders() { return UJD.memoize(filter(transform(getClasses(), UJD.JAVACLASS_TO_LOADER), Predicates.notNull())); }
From source file:org.mayocat.entity.DefaultEntityDataLoader.java
public <E extends Entity> List<EntityData<E>> load(List<E> entities, LoadingOption... options) { final boolean localize = Arrays.asList(options).indexOf(StandardOptions.LOCALIZE) >= 0; List<EntityData<E>> data = FluentIterable.from(entities).transform(new Function<E, EntityData<E>>() { public EntityData<E> apply(final E input) { if (input == null) { // Garbage in, garbage out return null; }//ww w .j ava 2 s .c o m E actual; if (localize && Localized.class.isAssignableFrom(input.getClass())) { actual = (E) localizationService.localize((Localized) input); } else { actual = input; } return new EntityData<E>(actual); } }).filter(Predicates.notNull()).toList(); for (DataLoaderAssistant assistant : assistants) { assistant.loadList(data, options); } return data; }
From source file:org.eclipse.xtext.util.formallang.ProductionStringFactory.java
@Override public String createForUnordertedChildren(boolean many, boolean optional, Iterable<String> children) { List<String> childrenSorted = Lists.newArrayList(Iterables.filter(children, Predicates.notNull())); Collections.sort(childrenSorted); return "(" + Joiner.on(" & ").join(childrenSorted) + ")" + card(many, optional); }
From source file:org.eclipse.sirius.business.internal.session.danalysis.MovidaSupport.java
void updatePhysicalVSMResourceURIs(Collection<Viewpoint> selectedViewpoints) { Set<URI> selected = Sets.newHashSet( Iterables.filter(Iterables.transform(selectedViewpoints, new Function<Viewpoint, URI>() { public URI apply(Viewpoint from) { return new ViewpointQuery(from).getViewpointURI().get(); }/*from w w w .j av a2 s .c o m*/ }), Predicates.notNull())); vsmResources = new VSMResolver( (org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry) ViewpointRegistry .getInstance()).resolve(selected); }
From source file:de.metas.ui.web.handlingunits.HUEditorProcessTemplate.java
protected final Stream<HuId> streamSelectedHUIds(@NonNull final HUEditorRowFilter filter) { return streamSelectedRows(filter).map(HUEditorRow::getHuId).filter(Predicates.notNull()); }
From source file:net.shibboleth.idp.attribute.filter.policyrule.logic.impl.AbstractComposedPolicyRule.java
/** * Constructor.//from w w w . j av a2s.co m * * @param theRules matchers being composed */ public AbstractComposedPolicyRule( @Nullable @NullableElements final Collection<PolicyRequirementRule> theRules) { ArrayList<PolicyRequirementRule> checkedMatchers = new ArrayList<>(); if (theRules != null) { CollectionSupport.addIf(checkedMatchers, theRules, Predicates.notNull()); } rules = ImmutableList.copyOf(Iterables.filter(checkedMatchers, Predicates.notNull())); }
From source file:com.eucalyptus.reporting.export.Export.java
public static ReportingExport export(final Date startDate, final Date endDate, final boolean includeDependencies) { final ReportingExport export = new ReportingExport(); final Conjunction criterion = Restrictions.conjunction(); if (startDate != null) { criterion.add(Restrictions.ge(CREATION_TIMESTAMP, startDate)); }//from w ww.j a va2 s . co m if (endDate != null) { criterion.add(Restrictions.lt(CREATION_TIMESTAMP, endDate)); } final List<ReportingEventSupport> actions = Lists.newArrayList(); export.addUsage( Iterables.filter( Iterables.transform( iterableExporter(criterion, getUsageClasses(), Collections.<ReportingEventSupport>emptyList(), includeDependencies), ExportUtils.toExportUsage(includeDependencies ? actions : null)), Predicates.notNull())); export.addActions( Iterables .transform( Iterables.concat(actions, iterableExporter(criterion, getEventClasses(), actions, includeDependencies)), Functions.compose(userAccountDecorator(), ExportUtils.toExportAction()))); return export; }
From source file:net.shibboleth.idp.attribute.filter.impl.policyrule.logic.AbstractComposedPolicyRule.java
/** * Constructor./*from ww w . j ava2s. c o m*/ * * @param theRules matchers being composed */ public AbstractComposedPolicyRule( @Nullable @NullableElements final Collection<PolicyRequirementRule> theRules) { ArrayList<PolicyRequirementRule> checkedMatchers = new ArrayList<PolicyRequirementRule>(); if (theRules != null) { CollectionSupport.addIf(checkedMatchers, theRules, Predicates.notNull()); } rules = ImmutableList.copyOf(Iterables.filter(checkedMatchers, Predicates.notNull())); }