I have a class that already has a 'natural' order, and wish to define a different Comparator that can be used similar to String.CASE_INSENSITIVE_ORDER
- i.e., define it as an instantiated static field to be referred to when needed.
With an interface Foo which is the actual comparison type (it will be Comparator<Foo>
), I'm in favor of putting it there rather than FooImpl (only one implementation in this specific case, if that makes a difference). It is implemented using an inner class similar to the String one, except of course that class must be public since Foo is an interface.
Wondering if it is better to put it in FooImpl instead of Foo, and if so why? Also I don't care about the public visibility of the implementing class, but should it be a standalone seperate package visible entity instead?