Print Any List With a Wildcard
easyQuestion 498The wildcard ? in List<?> means a list of any element type. Complete printAll so it prints every element of the list it receives, one per line, in order.
Requirements:
1. printAll(List<?> items) works for a List<String>, a List<Integer> and every other list.
2. Each element goes on its own line, printed with System.out.println.
3. An empty list prints nothing.
Do NOT write a main method.
Expected output
red green 2 3 5
= newline. The output ends with a newline, so print one after the last line.
Hints2 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.