Difference between revisions of "Use a Hash Table"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
{{topTenTips}} | {{topTenTips}} | ||
− | <question | + | <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
key | value |
---|---|
France | 60000000 |
China | 1300000000 |
You can use a hash table to record a number against the name of each country.
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]