Never mind about this, found a much better way (just for sets i think) by using a Integer as value as HashSet uses booleans as values and a delegate LinkedHashMap. Works for implementing < and > as long and i'm careful not to loose the old value in add().