How does the enhanced for statement work for arrays, and how to get an iterator for an array?

后端 未结 13 791
走了就别回头了
走了就别回头了 2020-11-27 04:59

Given the following code snippet:

int[] arr = {1, 2, 3};
for (int i : arr)
    System.out.println(i);

I have the following questions:

13条回答
  •  清歌不尽
    2020-11-27 05:58

    Arrays.asList(arr).iterator();

    Or write your own, implementing ListIterator interface..

提交回复
热议问题