org.apache.commons.collections.CollectionUtils.selectRejected()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.apache.commons.collections.CollectionUtils.selectRejected()方法的一些代码示例,展示了CollectionUtils.selectRejected()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CollectionUtils.selectRejected()方法的具体详情如下:
包路径:org.apache.commons.collections.CollectionUtils
类名称:CollectionUtils
方法名:selectRejected

CollectionUtils.selectRejected介绍

[英]Selects all elements from inputCollection which don't match the given predicate into an output collection.

If the input predicate is null, the result is an empty list.
[中]将inputCollection中与给定谓词不匹配的所有元素选择到输出集合中。
如果输入谓词为null,则结果为空列表。

代码示例

代码示例来源:origin: commons-collections/commons-collections

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: commons-collections/commons-collections

public void testSelectRejected() {
  List list = new ArrayList();
  list.add("One");
  list.add("Two");
  list.add("Three");
  list.add("Four");
  Collection output = CollectionUtils.selectRejected(list, EQUALS_TWO);
  assertEquals(4, list.size());
  assertEquals(3, output.size());
  assertTrue(output.contains("One"));
  assertTrue(output.contains("Three"));
  assertTrue(output.contains("Four"));
}

代码示例来源:origin: org.andromda.translationlibraries/andromda-ocl-validation-library

/**
 * Returns a subcollection of the source collection containing all elements for which the expression evaluates
 * <code>false</code>.
 * @param collection
 * @param predicate
 * @return CollectionUtils.selectRejected(collection, predicate)
 */
public static Collection reject(
    final Collection collection,
    final Predicate predicate)
{
  return CollectionUtils.selectRejected(collection, predicate);
}

代码示例来源:origin: org.mule/mule-core

/**
 * The exact opposite to {@link #collectEventsWithExceptions()} Returns all the
 * {@link MuleEvent}s which messages have a <code>null</code>
 * {@link ExceptionPayload} or a <code>null</code>
 * {@link ExceptionPayload#getException()}. Notice that this is a collect
 * operation. Each time this method is invoked the result will be re-calculated
 * 
 * @return a list of {@link MuleEvent}. It could be empty but it will never be
 *         <code>null</code>
 */
@SuppressWarnings("unchecked")
public List<MuleEvent> collectEventsWithoutExceptions()
{
  return (List<MuleEvent>) CollectionUtils.selectRejected(this.events, failedEventsPredicate);
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Selects all elements from inputCollection which don't match the given predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection  the collection to get the input from, may not be null
 * @param predicate  the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException if the input collection is null
 */
public static Collection selectRejected(Collection inputCollection, Predicate predicate) {
  ArrayList answer = new ArrayList(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: tupunco/tup.dota2recipe

/**
 * Selects all elements from inputCollection which don't match the given
 * predicate
 * into an output collection.
 * <p>
 * If the input predicate is <code>null</code>, the result is an empty list.
 * 
 * @param inputCollection
 *            the collection to get the input from, may not be null
 * @param predicate
 *            the predicate to use, may be null
 * @return the elements <b>not</b> matching the predicate (new list)
 * @throws NullPointerException
 *             if the input collection is null
 */
public static <E> Collection<E> selectRejected(Collection<E> inputCollection,
    Predicate<E> predicate) {
  ArrayList<E> answer = new ArrayList<E>(inputCollection.size());
  selectRejected(inputCollection, predicate, answer);
  return answer;
}

代码示例来源:origin: org.xworker/xworker_core

@SuppressWarnings("unchecked")
public static <E> List<E> selectRejected(ActionContext actionContext){
  Thing self = actionContext.getObject("self");
  Collection<? extends E> inputCollection = (Collection<? extends E>) self.doAction("getInputCollection", actionContext);
  Predicate predicate= (Predicate) self.doAction("getPredicate", actionContext);
  
  Collection<? extends E> cls = CollectionUtils.selectRejected(inputCollection, predicate);
  List<E> list = new ArrayList<E>();
  for(E e : cls){
    list.add(e);
  }
  
  return list;
}

代码示例来源:origin: com.atlassian.jira/jira-core

options = CollectionUtils.selectRejected(options,
    SPECIAL_OPTION_PREDICATE);

相关文章