List of usage examples for com.google.common.base Predicates notNull
@GwtCompatible(serializable = true) public static <T> Predicate<T> notNull()
From source file:org.polarsys.reqcycle.styling.ui.dnd.ReqDropAdapterAssistant.java
private Iterable<Reachable> getReachable(ISelection selection) { Collection<Reachable> result = Lists.newArrayList(); if (selection instanceof IStructuredSelection) { IStructuredSelection strucutred = (IStructuredSelection) selection; Iterator<?> iterator = strucutred.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); Reachable r;//www . ja va 2s . c o m try { r = manager.getHandlerFromObject(next).getFromObject(next).getReachable(); result.add(r); } catch (IReachableHandlerException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return Iterables.filter(result, Predicates.notNull()); }
From source file:org.opensaml.saml.metadata.resolver.filter.impl.NodeProcessingMetadataFilter.java
/** * Set the list of metadata node processors. * /* w ww. j a v a2s.c o m*/ * @param newProcessors the new list of processors to set. */ public void setNodeProcessors(@Nonnull @NonnullElements final List<MetadataNodeProcessor> newProcessors) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); Constraint.isNotNull(newProcessors, "MetadataNodeProcessor list cannot be null"); processors = new ArrayList<>(Collections2.filter(newProcessors, Predicates.notNull())); }
From source file:de.metas.ui.web.handlingunits.HUEditorRowFilter.java
@lombok.Builder(builderClassName = "Builder", toBuilder = true) private HUEditorRowFilter(@Nullable final Select select, @NonNull @Singular final Set<HUEditorRowId> onlyRowIds, @NonNull @Singular final ImmutableSet<String> onlyHUStatuses, @NonNull @Singular final ImmutableSet<String> excludeHUStatuses, @NonNull @Singular final Set<HuId> excludeHUIds, @Nullable final String userInputFilter) { this.select = select != null ? select : Select.ALL; this.onlyRowIds = ImmutableSet.copyOf(onlyRowIds); this.onlyHUStatuses = onlyHUStatuses; this.excludeHUStatuses = excludeHUStatuses; this.userInputFilter = userInputFilter; this.excludeHUIds = excludeHUIds.stream().filter(Predicates.notNull()) .collect(ImmutableSet.toImmutableSet()); }
From source file:net.shibboleth.idp.cas.config.ServiceTicketConfiguration.java
/** * Set the authentication flows to use./*from w ww . j a v a 2 s . c o m*/ * * @param flows flow identifiers to use */ public void setAuthenticationFlows(@Nonnull @NonnullElements final Collection<String> flows) { Constraint.isNotNull(flows, "Collection of flows cannot be null"); authenticationFlows = Sets.newHashSet(Collections2.filter(flows, Predicates.notNull())); }
From source file:com.viadeo.kasper.core.id.DefaultIDTransformer.java
@Override public Map<ID, ID> to(final Format format, final Collection<ID> ids) { checkNotNull(format);//from ww w . j a v a 2s . co m checkNotNull(ids); checkArgument(Iterables.all(ids, Predicates.notNull()), "Each specified ids must be not null"); return doConvertAll(format, ids); }
From source file:com.codereligion.diff.internal.linewriter.IterableLineWriter.java
/** * Transforms the given iterable value into a sorted list or throws an {@link MissingComparatorException} * if none was found./*from w ww . j a va 2s . c o m*/ * * @param path the path which describes the position of the given item's iterable in the object graph * @param value the property value to sort into a list * @return a new sorted list of the given iterable * @throws MissingComparatorException if no comparator could be found for the given iterable */ private List<Object> transformToSortedList(final String path, final Iterable<Object> value) { final List<Object> list = Lists.newArrayList(value); final Optional<Object> firstElement = Iterables.tryFind(list, Predicates.notNull()); if (!firstElement.isPresent()) { return list; } final Comparator<Object> comparator = findComparatorOrThrowException(path, firstElement.get()); Collections.sort(list, comparator); return list; }
From source file:org.eclipse.xtext.ui.editor.StatefulResourceDescription.java
protected ImmutableList<IEObjectDescription> copyExportedObjects(IResourceDescription original) { return ImmutableList.copyOf(Iterables.filter(Iterables.transform(original.getExportedObjects(), new Function<IEObjectDescription, IEObjectDescription>() { @Override//from www . j a v a 2s. c o m public IEObjectDescription apply(IEObjectDescription from) { if (from == null) return null; EObject proxy = from.getEObjectOrProxy(); if (proxy == null) return null; if (proxy.eIsProxy()) return from; InternalEObject result = (InternalEObject) EcoreUtil.create(from.getEClass()); result.eSetProxyURI(EcoreUtil.getURI(from.getEObjectOrProxy())); Map<String, String> userData = null; for (String key : from.getUserDataKeys()) { if (userData == null) { userData = Maps.newHashMapWithExpectedSize(2); } userData.put(key, from.getUserData(key)); } return EObjectDescription.create(from.getName(), result, userData); } }), Predicates.notNull())); }
From source file:com.facebook.buck.java.MavenUberJar.java
private static ImmutableSet<Path> toOutputPaths(Iterable<? extends BuildRule> rules) { return FluentIterable.from(rules).transform(new Function<BuildRule, Path>() { @Nullable//from ww w. j ava 2s . c o m @Override public Path apply(BuildRule input) { Path pathToOutput = input.getPathToOutput(); if (pathToOutput == null) { return null; } return input.getProjectFilesystem().resolve(pathToOutput); } }).filter(Predicates.notNull()).toSet(); }
From source file:org.polarsys.reqcycle.uri.impl.ExtenderManager.java
private static List<IReachableExtender> getAllRegistered() { return Lists//from w w w.j av a 2s . com .newArrayList(Iterables.filter(Iterables.transform( Arrays.asList(Platform.getExtensionRegistry() .getConfigurationElementsFor(Activator.PLUGIN_ID, EXT_EXTENDER_NAME)), new Function<IConfigurationElement, IReachableExtender>() { public IReachableExtender apply(IConfigurationElement conf) { IReachableExtender ext = null; try { ext = (IReachableExtender) conf.createExecutableExtension("instance"); ZigguratInject.inject(ext); } catch (CoreException e) { } return ext; } }), Predicates.notNull())); }
From source file:org.opensaml.xmlsec.encryption.support.ChainingEncryptedKeyResolver.java
/** * Constructor. /*from w ww . j ava2 s. c o m*/ * * @param encKeyResolvers the chain of encrypted key resolvers * @param recipients the set of recipients */ public ChainingEncryptedKeyResolver(@Nonnull final List<EncryptedKeyResolver> encKeyResolvers, @Nullable final Set<String> recipients) { super(recipients); Constraint.isNotNull(encKeyResolvers, "List of EncryptedKeyResolvers cannot be null"); resolvers = new ArrayList<>(Collections2.filter(encKeyResolvers, Predicates.notNull())); }