MESSAGE
DATE | 2016-05-22 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Hangout-NYLXS] Insane Java Syntax
|
This passes for a demonstration and teaching example for a TreeMap
import java.util.TreeMap; import java.util.Set; import java.util.Iterator; import java.util.Map;
public class Details {
public static void main(String args[]) {
/* This is how to declare TreeMap */ TreeMap tmap = new TreeMap(); < /*Adding elements to TreeMap*/ tmap.put(1, "Data1"); tmap.put(23, "Data2"); tmap.put(70, "Data3"); tmap.put(4, "Data4"); tmap.put(2, "Data5");
/* Display content using Iterator*/ Set set = tmap.entrySet(); < Iterator iterator = set.iterator(); < while(iterator.hasNext()) { Map.Entry mentry = (Map.Entry)iterator.next(); < System.out.print("key is: "+ mentry.getKey() + " & Value is: "); < System.out.println(mentry.getValue()); }
} } -- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 _______________________________________________ hangout mailing list hangout-at-nylxs.com http://www.nylxs.com/
|
|