T
Thomas Hawtin
Mike said:Based on what?
Implementation of java.util.RandomAccess and size.
Tom Hawtin
Mike said:Based on what?
Thomas said:That's not "wrong". It might give you poor performance in unusual cases,
but so might many things.
Thomas said:There is no must about it. Indeed java.util.Collections takes a smarter,
adaptive approach.
Chris Uppal said:Thomas said:There is no must about it. Indeed java.util.Collections takes a smarter,
adaptive approach.
To my mind, the use of the RandomAccess marker in Collections is better
characterised as indefensible switch-on-type than good programming. Same
goes
for java.util.AbstractList.subList(int, int) -- which is the /only/ other
place
where that marker interface is used[*] in the entire 1.5 JRE.
Thomas Hawtin said:It should be. Else you've done it wrong.
I'd be much more happy going into production with something that wasn't
heavily optimised than something that stopped working.
Mike said:I presume that RandomAccess is new for 1.5; I was unaware of it. It makes
much less sense as a marker interface than as the place where get() etc. are
defined.
Thomas said:Most uses of Lists are random access,
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.