CJCoding With Joseph
15free / daySign inCreate account

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]

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
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.