โ Back to Methods
Question 183
Create a Generic Method That Repeats a Value
Create a Generic Method That Repeats a Value
Complete the generic methodrepeatValuethat takes a value and a count, then returns anArrayList<T>containing that value repeatedcounttimes. IMPORTANT: Do NOT write a main method. A hidden test will callRepeatTool.repeatValue("Hi", 3)andRepeatTool.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.