Difference between revisions of "Use a Hash Table"

From Progzoo
Jump to navigation Jump to search
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{

Revision as of 02:14, 1 January 2008

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]