Example usage for org.apache.commons.collections4 PredicateUtils andPredicate

List of usage examples for org.apache.commons.collections4 PredicateUtils andPredicate

Introduction

In this page you can find the example usage for org.apache.commons.collections4 PredicateUtils andPredicate.

Prototype

public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1,
        final Predicate<? super T> predicate2) 

Source Link

Document

Create a new Predicate that returns true only if both of the specified predicates are true.

Usage

From source file:com.feilong.core.util.CollectionsUtilTest.java

/**
 * Test find2.//from ww w. j  a  va 2 s.co m
 */
@Test
public void testFind2() {
    User guanyu30 = new User("", 30);
    List<User> list = toList(//
            new User("", 23), new User("", 24), new User("", 25), guanyu30);
    Predicate<User> predicate = PredicateUtils.andPredicate(BeanPredicateUtil.equalPredicate("name", ""),
            BeanPredicateUtil.equalPredicate("age", 30));

    assertEquals(guanyu30, CollectionsUtil.find(list, predicate));
}