When should I accept a parameter of Iterable vs. Collection in Java?

后端 未结 9 1723
独厮守ぢ
独厮守ぢ 2021-01-30 01:06

What are the considerations of using Iterable vs. Collection in Java?

For example, consider implementing a type that is primarily concerned with contai

9条回答
  •  野性不改
    2021-01-30 01:17

    Some constructors, e.g. ArrayList(Collection c), use the toArray() method of Collection for efficiency.

提交回复
热议问题