Difference between revisions of "Use a Hash Table"

From Progzoo
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{topTenTips}}
 
{{topTenTips}}
<question xmlns:htm="http://www.w3.org/1999/xhtml" lang="java" className="Demo"><table style="border-style:solid;float:right"><caption>pop</caption>
+
<question lang="java" className="Demo">
 +
<table style="border-style:solid;float:right"><caption>pop</caption>
 
<tr><th>key</th><th>value</th></tr>
 
<tr><th>key</th><th>value</th></tr>
 
<tr><td>France</td><td align="right">60000000</td></tr>
 
<tr><td>France</td><td align="right">60000000</td></tr>
Line 8: Line 9:
 
You can use a <b>hash table</b> to record a number against the name of
 
You can use a <b>hash table</b> to record a number against the name of
 
each country.
 
each country.
</p><prog>
+
</p>
 +
<prog>
 
import java.util.HashMap;
 
import java.util.HashMap;
 
public class Demo{
 
public class Demo{
Line 20: Line 22:
 
}
 
}
 
</prog>
 
</prog>
<p>
 
</p>
 
 
</question>
 
</question>
 +
For more on [[Hash Maps]]

Latest revision as of 17:31, 19 October 2011

pop
keyvalue
France60000000
China1300000000

You can use a hash table to record a number against the name of each country.


[Font] [Default] [Show] [Resize] [History] [Profile]

For more on Hash Maps