Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this problem set, you will submit a single java file named Homework.java. You are supposed to add the functions described below to your Homework
For this problem set, you will submit a single java file named Homework.java. You are supposed to add the functions described below to your Homework class. The functional signatures of the functions you create must exactly match the signatures provided below. You are not allowed to use any rd party libraries in the homework assignment. When you have completed your homework, upload the Homework.java file to Grader Than. All tests will timeout and fail if your code takes longer than seconds to complete.
Remove Duplicates
This function will receive a list of elements with duplicate elements, this function should remove the duplicate elements in the list and return a list without duplicate elements. The elements in the returned list must be in the same order that they were found in the list the function received. A duplicate element is an element found more than one time in the specified list.
Signature:
public static ArrayList
This function will receive a list of elements with duplicate elements. It should add all of the duplicate elements to a set and return the set containing the duplicate elements. A duplicate element is an element found more than one time in the specified list. The order of the set does not matter.
Signature:
public static HashSet
OUTPUT:
Remove Char
This function will be given a list of strings and a character. You must remove all occurrences of the character from each string in the list. The function should return the list of strings with the character removed.
Signature:
public static ArrayListlist;
Example:
list: adndj 'adjdlaa', aa 'djoe'
pattern: a
Output: dndjdjdl 'djoe'
Return Growing NumList
This function will be given a single number, it should return a list of strings of numbers. Each string in the list will only contain a single number repeated an arbitrary amount of times. The number each string will contain will be equal to the current string's index The number in the string should be repeated the same number of times as the string's index Each number in the string should be separated by a space. This list should stop when its size equals the max number specified.
Signature:
public static ArrayList
OUTPUT:
Unique Values
This function will receive a single map parameter known as amap. amap will contain a single letter as a string and numbers as values. This function is supposed to search amap to find all values that appear only once in amap. The function will create another map named toret. For all values that appear once in amap the function will add the value as a key in toret and set the value of the key to the key of the value in amap swap the keyvalue pairs, since amap contains letters to numbers, toret will another map named toret. For all values that appear once in amap the function will add the value as a key in toret and set the value of the key to the key of the value in amap swap the keyvalue pairs, since amap contains letters to numbers, toret will contain Numbers to Letters Finally, the function should return toret.
Signature:
public static HashMap
INPUT:
OUTPUT:
Concatenate Map
This function will be given a single parameter known as the Map List. The Map List is a list of maps. Your job is to combine all the maps found in the map list into a single map and return it There are two rules for adding values to the map.
You must add keyvalue pairs to the map in the same order they are found in the Map List. If the key already exists, it cannot be overwritten. In other words, if two or more maps have the same key, the key to be added cannot be overwritten by the subsequent maps.
Signature:
public static HashMap
INPUT:
OUTPUT:
INPUT:
OUTPUT:
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