开发者

How to Create a Method that only accepts elements that implement Iterable

开发者 https://www.devze.com 2023-01-06 21:40 出处:网络
I want to write a function printAll(), which accepts only those elements that implement 开发者_开发知识库that implement Iterable so that I can iterate over them and print the elements. How do I do tha

I want to write a function printAll(), which accepts only those elements that implement 开发者_开发知识库that implement Iterable so that I can iterate over them and print the elements. How do I do that?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号