(implementing ArrayList) ArrayList is implemented in the Java API. ImplementArra
ID: 3611076 • Letter: #
Question
(implementing ArrayList) ArrayList is implemented in the Java API. ImplementArrayList and the methods defined in tablebelow. (Hint: Use an array to store the elements in ArrayList. If the size of the ArrayList exceeds thecapacity of the current array, create a new array that doubles thesize of the current array and copy the contents of the current tothe new array.)java.util.ArrayList
+ArrayList() Creates an empty list
+add(o: Object):void Appends a new element o at the end of this list
+add(index: int, o: Object):void Adds a new element o atthe specified index in this list
+clear():void Removes all the elements from this list
+contains(o: Object):boolean Returns true if this list contains the element o
+get(index: int):Object Returns the element from this list at at the specified index
+indexOf(o: Object):int Returns the index of the first matching element in this list
+isEmpty():boolean Returns true if this list contains no elements
+lastIndexOf(o: Object):int Returns the index of the last matching element in this list
+remove(o: Object):boolean Removes the element o from the list
+size():int Returns the number of elements in this list
+remove(index: int):boolean Removes the element at the specified index
+set(index: int, o: Object):Object Sets the element at thespecified index
Explanation / Answer
(implementing ArrayList) ArrayList is implemented in the Java API. ImplementArra
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.