Web / Apache Commons Collections Interview questions
What is the purpose of CollectionUtils in Apache Commons Collections?
CollectionUtils is a static helper class packed with null-safe operations for working with any java.util.Collection, so callers don't have to hand-roll the same boilerplate checks repeatedly.
isEmpty(coll)/isNotEmpty(coll)- null-safe emptiness checksunion(),intersection(),subtract(),disjunction()- set-style operations across two collectionsfilter()/select()- keep elements matching a Predicatecollect()- transform elements with a TransformerforAllDo()- run a Closure against every element
These methods accept plain Collection references, so they work uniformly across Lists, Sets, and Bags without extra casting.
More Related questions...