Printing elements

Report a typo

Here is a method that prints the elements of a set. How can we make it print elements of any collection?

public static void printElements(Set<String> elements) {
    for (String element : elements) {
        System.out.println(element);
    }
}

What can we use instead of Set to make it possible to print elements stored in Set's and List's?

Select one or more options from the list
___

Create a free account to access the full topic