Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List predicatedList = ListUtils.predicatedList(new ArrayList(), PredicateUtils.notNullPredicate());
- ...
- predicatedList.add(null); // throws an IllegalArgumentException
- try
- {
- predicatedList.add(null);
- }
- catch(IllegalArgumentException e)
- {
- //ignore the exception
- }
- List l = new ArrayList();
- l.add("A");
- l.add(null);
- l.add("B");
- l.add(null);
- l.add("C");
- System.out.println(l); // Outputs [A, null, B, null, C]
- CollectionUtils.filter(l, PredicateUtils.notNullPredicate());
- System.out.println(l); // Outputs [A, B, C]
Add Comment
Please, Sign In to add comment