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:com.tinspx.util.collect.NotNull.java

/**
 * Wraps {@code set} as a {@code Set} that doe not allow {@code null}
 * elements to be added./*www .ja  v  a  2 s  . com*/
 *
 * @throws NullPointerException if any existing element in {@code set} is
 * {@code null}
 */
public static <E> Set<E> set(Set<E> set) {
    CollectUtils.checkAllNotNull(set);
    return Predicated.set(set, Predicates.notNull());
}

From source file:org.eclipse.xtext.util.formallang.ProductionStringFactory.java

@Override
public String createForAlternativeChildren(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:ec.nbdemetra.ui.interchange.ImportAction.java

private static List<Importable> getImportables(Node[] activatedNodes) {
    return Nodes.asIterable(activatedNodes).transform(Jdk6Functions.lookupNode(Importable.class))
            .filter(Predicates.notNull()).toList();
}

From source file:ec.nbdemetra.ui.actions.AbilityAction.java

@Override
protected void performAction(Node[] activatedNodes) {
    performAction(Nodes.asIterable(activatedNodes).transform(function).filter(Predicates.notNull()));
}

From source file:eu.esdihumboldt.hale.common.lookup.impl.LookupTableImpl.java

/**
 * Create a new lookup table based on the given map.
 * //from  w ww .  j a  v  a2  s . c  o m
 * @param table the lookup table map
 */
public LookupTableImpl(Map<Value, Value> table) {
    super();
    // ignore null values, so their entries don't show up in any methods
    this.table = new LinkedHashMap<Value, Value>(Maps.filterValues(table, Predicates.notNull()));
}

From source file:org.incode.eurocommercial.contactapp.dom.role.ContactRoleRepository.java

@Programmatic
public SortedSet<String> roleNames() {
    final ImmutableList<String> roleNames = FluentIterable.from(listAll()).transform(ContactRole::getRoleName)
            .filter(Predicates.notNull()).toList();
    return Sets.newTreeSet(roleNames);
}

From source file:de.metas.ui.web.pickingslotsClearing.process.PackingHUsViewBasedProcess.java

protected final List<I_M_HU> retrieveEligibleHUs() {
    final Set<HuId> huIds = streamEligibleHURows().map(HUEditorRow::getHuId).filter(Predicates.notNull())
            .collect(ImmutableSet.toImmutableSet());
    Check.assumeNotEmpty(huIds, "huIds is not empty"); // shall not happen

    final List<I_M_HU> hus = queryBL.createQueryBuilder(I_M_HU.class)
            .addInArrayFilter(I_M_HU.COLUMN_M_HU_ID, huIds).addOnlyActiveRecordsFilter().create()
            .list(I_M_HU.class);
    Check.assumeNotEmpty(hus, "hus is not empty"); // shall not happen

    return hus;//from  www. j  ava2  s  .  c om

}

From source file:org.opensaml.xmlsec.impl.BlacklistPredicate.java

/**
 * Constructor.// www. ja v  a 2  s .  c om
 *
 * @param algorithms collection of blacklisted algorithms
 */
public BlacklistPredicate(@Nonnull Collection<String> algorithms) {
    Constraint.isNotNull(algorithms, "Blacklist may not be null");
    blacklist = new HashSet<>(Collections2.filter(algorithms, Predicates.notNull()));
}

From source file:org.opensaml.xmlsec.impl.WhitelistPredicate.java

/**
 * Constructor.//from  w  w  w. java2s  .  c  o  m
 *
 * @param algorithms collection of whitelisted algorithms
 */
public WhitelistPredicate(@Nonnull Collection<String> algorithms) {
    Constraint.isNotNull(algorithms, "Whitelist may not be null");
    whitelist = new HashSet<>(Collections2.filter(algorithms, Predicates.notNull()));
}

From source file:de.metas.ui.web.pporder.process.WEBUI_PP_Order_Template.java

protected final Stream<PPOrderLineRow> streamPPOrderLineRows() {
    return streamSelectedRows().map(PPOrderLineRow::cast).filter(Predicates.notNull());
}