I'm using a TreeSet<Integer>
and I'd quite simply like to find the index of a number in the set. Is there a nice way to do this that actually makes use of the O(log(n)) complexity of binary trees?
(If not, what should I do, and does anyone know why not? I'm curious why such a class would be included in Java without something like a search function.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…