The java foreach

Queue<String> myQueue = new LinkedList<String>();
myQueue.add("A");
myQueue.add("B");
myQueue.add("C");
myQueue.add("D");

List<String> myList = new ArrayList<String>(myQueue);

for (String theFruit : myList)
  System.out.println(theFruit);

Reproduced in: https: //www.cnblogs.com/fanzi2009/archive/2009/12/23/1630191.html

Guess you like

Origin blog.csdn.net/weixin_34380948/article/details/94192661