[英]How to Create a Method that only accepts elements that implement Iterable
我想編寫一個函數printAll(),該函數僅接受那些實現了Iterable的元素,以便我可以對其進行迭代並打印這些元素。 我怎么做?
public static void printAll(final Iterable<?> toIterate)
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.