MCPcopy Create free account
hub / github.com/apache/nutch / sortInverseByValue

Method sortInverseByValue

src/java/org/apache/nutch/util/Histogram.java:74–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 public List<E> sortInverseByValue() {
75 List<Map.Entry<E, HistogramEntry>> list = new Vector<Map.Entry<E, HistogramEntry>>(
76 map.entrySet());
77
78 // Sort the list using an annonymous inner class implementing Comparator for
79 // the compare method
80 java.util.Collections.sort(list,
81 new Comparator<Map.Entry<E, HistogramEntry>>() {
82 public int compare(Map.Entry<E, HistogramEntry> entry,
83 Map.Entry<E, HistogramEntry> entry1) {
84 return (entry.getValue().equals(entry1.getValue()) ? 0 : (entry
85 .getValue().value < entry1.getValue().value ? 1 : -1));
86 }
87 });
88 List<E> list2 = new Vector<E>();
89 for (Map.Entry<E, HistogramEntry> entry : list) {
90 list2.add(entry.getKey());
91 }
92 return list2;
93 }
94
95 public List<E> sortByValue() {
96 List<Map.Entry<E, HistogramEntry>> list = new Vector<Map.Entry<E, HistogramEntry>>(

Callers

nothing calls this directly

Calls 2

getKeyMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected