Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MAP List Iterator
//Title of this code //'main' method must be in a class 'Rextester'. import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { System.out.println("Hello, World!"); List<String> lst = new ArrayList<String>(); lst.add("a"); lst.add("b"); lst.add("c"); System.out.println("FOR"); for(String obj : lst) { System.out.println(obj); } System.out.println("ITERATOR"); Iterator<String> itr = lst.iterator(); while(itr.hasNext()){ System.out.println(itr.next()); } Map<String,String> mp = new HashMap<String,String>(); mp.put("1","a"); mp.put("2","b"); mp.put("3","c"); Set<String> s = mp.keySet(); for(String o:s) { System.out.println(o); } Collection<String> s1 = mp.values(); for(String o1:s1) { System.out.println(o1); } Iterator<Map.Entry<String,String>> me = mp.entrySet().iterator(); while(me.hasNext()) { Map.Entry<String,String> entry = me.next(); String key = entry.getKey(); String value = entry.getValue(); System.out.println("key "+key+" value "+value); } } }
run
|
edit
|
history
|
help
0
Coding For Fandroid
Hello
Thread counter
Minimum Vertices to Traverse Directed Graph
updated
nth fibonacci ( memoization )
Huffman Encoding Tree
jsis
1a
Problem_fib