Question
I need help with writting the code for these method, each for array list and linked array addUnique(T[] array) : add the elements in the
I need help with writting the code for these method, each for array list and linked array
addUnique(T[] array) : add the elements in the array to the list UNLESS it is already in the list, then don't add it. If the list is full but you still have more to add, then ignore the rest of the array and return.
lastLocation(T item) : return the location of the last occurrence of the item in the list.
removeDuplicate() : remove any duplicate items in the list without copying the list into a new structure. This is a very hard method to write! I suggest you do this after you have everything else done so you don't waste too much time trying to write it then debug it. You can still get an A as long as you give it a try -- even if it doesn't work.
toArray(T[] array) : as long as all of the elements in the List can fit into the array, then copy them into the array, maintaining their order. If they don't fit, don't copy anything over.
in Java please
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started