如何创建仅接受实现Iterable的元素的方法

unj*_*nj2 2 java generics collections types iterable

我想编写一个函数printAll(),它只接受那些实现Iterable实现的元素,这样我就可以迭代它们并打印元素.我怎么做?

Han*_*Gay 7

public static void printAll(final Iterable<?> toIterate).