Question: ArrayListMethods Write a class that contains the following methods: reverse(ArrayList list) that reverses the order of the elements in an ArrayList list of strings. capitalizePlurals(ArrayList
ArrayListMethods Write a class that contains the following methods: reverse(ArrayList list) that reverses the order of the elements in an ArrayList list of strings. capitalizePlurals(ArrayList list) that accepts an ArrayList list of strings and replaces every word ending with an s with its uppercased version. Hint: use ArrayList.endsWith() removePlurals(ArrayList list) that accepts an ArrayList list of strings and removes every word in the list ending with an s , case-insensitively. ArrayList list3 intersect(ArrayList list1, ArrayList list2) that accepts two sorted array lists of integers as parameters and returns a new list that contains only the elements that are found in both lists. Example: if lists named list1 and list2 initially store: list1 = [1 , 4, 8, 9, 11 , 15 , 17 , 28 , 41 , 59] list2 = [4 , 7, 11 , 17 , 19 , 20 , 23 , 28 , 37 , 59 , 81] Then the call of intersect(list1, list2) returns the list: [4 , 11 , 17 , 28 , 59] Write a client class to test all your methods.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
