When I’ve used common-collections I’ve done custom extensions to those utils like:
class MyCollectionUtils extends CollectionsUtils {
static myutilityMethod()
static removeDublicate(..)
static myPredicate(...)
}
In that case I have all functionality from CollectionsUtils and my extension methods with only one import!
In guava all static utilities classes are final.
What is the best approach to extend the guava collection API? For example, new common used predicate, collection factory etc, collection combiner.
For one why answer, readability. The reader now needs to know all about your utility class, even for methods which just forward to Guava.
Is that a standard ArrayList or a special list I’ve initialized with default values? Even if I know Guava inside and out, I can’t know the answer until I’ve examined your API. And client code can’t guarantee that it will remain the simple Guava version (perhaps you’ll stop inheriting from Guava, and just implement all the list methods yourself).