Skip to content

Instantly share code, notes, and snippets.

@ejknapp
Created March 14, 2014 01:44
Show Gist options
  • Save ejknapp/9540727 to your computer and use it in GitHub Desktop.
Save ejknapp/9540727 to your computer and use it in GitHub Desktop.
package java112.labs2;
import java.io.*;
import java.util.*;
/**
* @author Eric Knapp
* class MapDemo
*/
public class MapDemo {
public void run() {
Map<String, Integer> map = new TreeMap<String, Integer>();
map.put("one", 1);
map.put("two", 2);
map.put("three", 3);
map.put("four", 4);
map.put("five", 5);
for (Map.Entry entry : map.entrySet()) {
System.out.println(entry.getKey() + "\t" + entry.getValue());
}
}
public static void main(String[] args) {
MapDemo demo = new MapDemo();
demo.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment