Modifications apportés
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package fr.iutfbleau.sae.mhuffman;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
|
||||
public class ComparateurCanonique implements Comparator<Map.Entry<Integer, String>> {
|
||||
|
||||
@Override
|
||||
public int compare(Map.Entry<Integer, String> entree1,Map.Entry<Integer, String> entree2) {
|
||||
|
||||
int longueur1 = entree1.getValue().length();
|
||||
int longueur2 = entree2.getValue().length();
|
||||
|
||||
if (longueur1 != longueur2) {
|
||||
return longueur1 - longueur2;
|
||||
}
|
||||
|
||||
return entree1.getKey() - entree2.getKey();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user