Proper way for two-way sorting
问题 I've got a simple java pojo which looks like this: class MyClass { public String getGroup(); public String getTitle(); } Now what I want to do is to primarily sort a list of MyClass pojo by the values returned by the getTitle() method. Easy going though using my own comparator. However, what I want is that instances with the same value returned by getGroup() being followed by each other. Now what I did was something like .. compare(MyClass c1, MyClass c2) { if (c1.getGroup().compareTo(c2