I am using a Java Comparator to sort an ArrayList of SomeClass items. It works just fine, no problems. What I'm curious about is the syntax. Given:
 public static class PrioritizedPendingListComparator implements Comparator<SomeClass> {
        @Override
        public int compare(SomeClass o1, SomeClass o2) {
        ...
        }
And then, some time later,
private ArrayList<SomeClass> pendingList = new ArrayList<>(); 
... // fill it up with entries
Collections.sort(pendingList, new SomeClass.PrioritizedPendingListComparator());
I use new SomeClass.PrioritizedPendingListComparator() as the second argument to Collections.sort(). My comparator, PrioritizedPendingListComparator, is static so I don't expect to have to use new.
- Why can I not just use SomeClass.PrioritizedPendingListComparatore.g. why do I need thenew?
- How would I know this from reading the documentation?
 
    