I have a TreeBasedTable
object from Guava (Gooogle Collections). It is in the form of TreeBasedTable<k1, k2, v>
. k1
and k2
implement Comparable
. Now when I display the table, I want the user to be able to sort it different ways to change the order of the values.
The approach I tried was to iterate over the table, and for each value, change a variable that's used in the Compare method. The trouble is it gets through the loop once, and then returns a NullPointerException
, which I think I've narrowed down to trying to change the order whilst iterating over it (rookie mistake, I know).
So I was wondering, what would be a good way to reorder this table?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…