I need help with this assignment. It\'s data structures using Java. I just need
ID: 3800669 • Letter: I
Question
I need help with this assignment. It's data structures using Java. I just need to find the methods in Vector and ArrayList that most closely match our own List methods from the Java API.
The Java API contains two important structures for managing array-based lists. One, the Vector, manages lists in a thread-safe manner (for concurrency) and the other, the newer ArrayList, does the same but without the overhead required for multiprocessing thread-safety. How do these implementations compare with our own? Look at the online Java API documentation for both and post the following five details, for each of them, into a text file, attach it back to this assignment and send it in (you should have five methods listed for the Vector and another five listed for the ArrayList in a tabular arrangement):
Find the methods in Vector and ArrayList that most closely match our own List methods of:
Now be careful! Compare our methods not necessarily by their names, but by their function, parameters and return types.
Thanks in advance.
Explanation / Answer
you didn't give the books linkedListclass, Any ways considering it as a normal linkedlist implementation.
Book's LinkedListClass Java's Vector Java's ArrayList
------------------------- ------------------------- -------------------------
1. isEmpty isEmpty() will be similar for all the type, since vector and arraylist are also a linkedlist.
2. retrieveAt get(int index),elementAt(int index)(older implementation in vector) get(int index)
3. seqSearch contains(Object o) contains(Object o)
4. removeAt remove(int index),removeElementAt(int index)(older implementation) remove(int index)
5. listSize size(),capacity() size()
For vector elementAt(int index), removeElementAt(int index) and capacity() are older implementations before it started to extend AbstractList.