# maps - aps aps Maps Maps et's add variables to our simple...

This preview shows pages 1–5. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: aps aps Maps Maps et's add variables to our simple calculator Let s add variables to our simple calculator. A variable should store a number. A = 7 > A = 7 ==> A = 7 > 3 * (A + 5) ==> 36 uilding a concordance uilding a concordance Building a concordance Building a concordance ow to print the map ow to print the map How to print the map How to print the map The Map interface allows to return all the key values in the map in a Set . A Set is another ADT (Java interface). It represents-no big surprise-a set of objects. To look at all the elements of a Set, we use an iterator . Set<String> keys = map.keySet(); Iterator<String> it = keys.iterator(); while (it.hasNext()) { String k = it.next(); System.out.println(k + "\t: " + map.get(k)); } In what order are the elements of the set returned by the iterator? Getting rid of duplicated line Getting rid of duplicated line numbers numbers ap<String, List<Integer>> map = Map<String, List<Integer>> map new TreeMap<String, List<Integer>>(); // ......
View Full Document

## This note was uploaded on 04/20/2010 for the course CS CS206 taught by Professor Lee during the Fall '09 term at 카이스트, 한국과학기술원.

### Page1 / 6

maps - aps aps Maps Maps et's add variables to our simple...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online