user3331469
user3331469

Reputation: 21

The type new Comparator(){} must implement the inherited abstract method Comparator.compare(Object, Object)

please help her. I had an error in

  Collections.sort(var4, new Comparator() {
     public int compare(TreeMap var1, TreeMap var2) {
        return ((String)var1.get("col_3")).compareTo((String)var2.get("col_3"));
     }
  });

Upvotes: 0

Views: 6145

Answers (1)

Lucifer
Lucifer

Reputation: 29632

Try this way by adding to Comparator ,

Collections.sort(var4, new Comparator<TreeMap>() 
{
     public int compare(TreeMap var1, TreeMap var2) 
     {
        return ((String)var1.get("col_3")).compareTo((String)var2.get("col_3"));
     }
});

Upvotes: 1

Related Questions