开发者

Automatic indexed sorted array maintained by Java?

Is there a feature in java by which I define an array as to keep it in a sorted fashion which will let me insert or remove an element in this array. This is to avoid expensive re-sort开发者_开发百科 when an element is to be added or removed?


If you are storing Objects in your Array which are not duplicated and can be compared using a Comparable, you could use a TreeSet which will keep your elements in order at all times.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜