Is there an efficient way to get the n upper entries from a sorted Multiset (TreeMultiset)?
To specify what I mean I post my inefficient solution:
public SortedMultiset<DataTuple> headMultiset(int upperBound, BoundType boundType){
int i=0;
DataTuple act= this.coreData.firstEntry().getElement();
Iterator<DataTuple> itr = this.coreData.iterator();
while(i<=upperBound){
act = itr.next();
i+=this.coreData.count(act);
}
return headMultiset(act, boundType);
}
In this example DataSet can be seen as Object and this.coreData is the underling TreeMultiset.
I'm really new to that topic, so all kinds of comments would be appreciated.