I have a hashmap with a triplet like this:
HashMap<String, List<Triplet<String,Integer,Integer>>> output = new HashMap<String, List<Triplet<String,Integer,Integer>>>();
Where the key is a file name and triplet contains information of a word and its frequency information(tf and df).E.g.
{File1 = {coffee,23,1},{caffeine,12,2},{brew,9,1}; File2 = {}.......}
I want to sort the values of this list of triples according to the second value of the triplet i.e tf (term frequency).
for (Entry<String, List<Triplet<String, Integer, Integer>>> entry : output.entrySet()) {
String key = entry.getKey();
List<Triplet<String, Integer, Integer>> value = entry.getValue();
What will come next?
Here's what Triplet looks like:
public class Triplet<T, U, V> {
private final T first;
private final U second;
private final V third;
public Triplet(T first, U second, V third) {
this.first = first;
this.second = second;
this.third = third;
}
public T getFirst() {
return first;
}
public U getSecond() {
return second;
}
public V getThird() {
return third;
}
}
Any help, guidance will be appreciated.