Common Ancestor to Java Array and List

后端 未结 6 1959
闹比i
闹比i 2020-12-18 19:54

In .NET, both array and list have Enumerable as ancestor, so a method that accept Enumerable as an argument can receive both array and list as its argument. I wonder if ther

6条回答
  •  清酒与你
    2020-12-18 20:01

    Iterable is the Java equivalent of IEnumerable. All/most collections implement this interface (including ArrayList and arrays), so yes. But it's not an "ancestor" (which it's not in .NET either), but a common interface.

提交回复
热议问题