- Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathTestIterator.java
More file actions
Latest commit
21 lines (18 loc) · 492 Bytes
/
Copy pathTestIterator.java
File metadata and controls
21 lines (18 loc) · 492 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
packageu020;
importjava.util.Arrays;
importjava.util.Iterator;
importjava.util.List;
/**
* Created by HuGuodong on 12/2/19.
*/
publicclassTestIterator {
publicstaticvoidmain(String[] args) {
List<String> songs = Arrays.asList("南方姑娘", "曾经的你", "Lydia");
Iterator<String> playListIterator = songs.iterator();
while (playListIterator.hasNext())
System.out.println(playListIterator.next());
// 南方姑娘
// 曾经的你
// Lydia
}
}