Create a Generic Method That Repeats a Value
mediumQuestion 183Complete the generic method repeatValue that takes a value and a count, then returns an ArrayList<T> containing that value repeated count times.
IMPORTANT: Do NOT write a main method. A hidden test will call RepeatTool.repeatValue("Hi", 3) and RepeatTool.repeatValue(4, 2) and print each resulting list.
Expected output
[Hi, Hi, Hi] [4, 4]
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
GenericsMethods
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.