Java Code Examples for org.apache.commons.collections.CollectionUtils.select()

The following are Jave code examples for showing how to use select() of the org.apache.commons.collections.CollectionUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: aws-codecommit-trigger-plugin   File: StringUtilsTest.java   View Source Code Vote up 6 votes
@Test
@SuppressWarnings("unchecked")
public void testSelects() {
    Record r = new Record();
    r.setUserIdentityARN("arn:sample");
    List<Record> records = Arrays.asList(r, new Record());
    Collection<Record> sample = CollectionUtils.select(records, new Predicate() {
        @Override
        public boolean evaluate(Object o) {
            return o instanceof Record && ((Record) o).getUserIdentityARN() != null &&  ((Record) o).getUserIdentityARN().contains("sample");
        }
    });

    Assertions.assertThat(sample).hasSize(1);
}