CJCoding With Joseph
15per day

Create a Generic Method That Repeats a Value

Complete 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]
Topics:
GenericsMethods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.