Last active
October 16, 2017 22:54
-
-
Save pravsingh/b94f9d40cbc0505cdf42144b85d4e79d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.designingmicroservices; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
/** | |
* | |
* @author DesigningMicroservices.com | |
* | |
*/ | |
public class CollectionsIteratorApplication { | |
public static void main(String[] args) { | |
Collection<String> collection1 = new ArrayList<String>(); | |
collection1.add("zero"); | |
collection1.add("one"); | |
Collection<String> collection2 = new ArrayList<String>(); | |
collection2.add("2.zero"); | |
collection2.add("2.one"); | |
collection2.add("2.two"); | |
Collection<Collection<String>> col = new ArrayList<Collection<String>>(); | |
col.add(collection1); | |
col.add(collection2); | |
CollectionsIterator<String> iterator = new CollectionsIterator<String>(col); | |
// while loop | |
while (iterator.hasNext()) { | |
System.out.println("value= " + iterator.next()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment