Is there a better way to write this (collection) helper class

I want to know if there is a better way to write the following class

public class Helper { public static boolean isMatch(final Collection<ClassA> customList) public static boolean containsProperty(final Collection<ClassA> customList, final String property) } 

Method call method:

 Helper.isMatch(customList); 

I would like to make a call like:

 customList.isMatch(); 

Any advice would be great.

+4
source share
1 answer

If you use Guava, you can use, for example, ForwardingList .

It forwards the entire default List method to the inline instance, and you can add your own.

More details here .

+1
source

All Articles