what is the significance of the RandomAccess interface for list implementations? By marking my list implementation using this interface will i get any support from the JVM interms of checks?
Help me!Help you!!!
Joined: Jan 30, 2000
It does just what the API says it does - it allows other code to decide (using instanceof) whether get(int) is an efficient method to use on this list, or whether it's better to use an Iterator. This allows code such as the Collections class to perform better, as it can chose an algorithm suited to the performance characteristics of the List. Check out the source code of java.util.Collections (in src.zip) to see examples of this. By marking my list implementation using this interface will i get any support from the JVM interms of checks? Assuming your list implementation really is a random-access list (e.g. not a linked list), you get better performance from some methods in Collections, and possibly other classes. That's it. [ May 20, 2002: Message edited by: Jim Yingst ]
"I'm not back." - Bill Harding, Twister
Joined: Nov 21, 2000
hey thanx jim i'll look into the collections class and see how ramdom access is been used