Warning: include_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 2

Warning: include_once(http://www.confrage.com/bin/header.php): failed to open stream: no suitable wrapper could be found in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 2

Warning: include_once(): Failed opening 'http://www.confrage.com/bin/header.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 2
Mapのキー | Java | 株式会社CONFRAGE
Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/menu.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 17

Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/menu.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 17
Mapのキー
MapのキーはObject型のため、何でもキーにすることが出来ます。
そのため、String型の0とBigDecimal型の0は異なるキーとして扱われます。
以下、例です。

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

public class Test {
	public static void main(String[] args) throws Exception{

		Map map = new HashMap();
		map.put(new BigDecimal("1"),"TEST1");
		map.put("1","TEST2");
		
		System.out.println(map.get("1".toString()));
		System.out.println(map.get(new BigDecimal("1")));
	}
}
実行結果は以下のようになります。

TEST2
TEST1

Back to top

Information

Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/side_bar.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 79

Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/side_bar.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 79

Warning: include_once(/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/seo.php): failed to open stream: No such file or directory in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 88

Warning: include_once(): Failed opening '/home/sites/heteml/users/m/o/r/moriya-h5/web/confrage/bin/seo.php' for inclusion (include_path='.:/usr/local/php/5.6/lib/php') in /home/users/2/moriya-h5/web/confrage/java/map/mapkey/mapkey.html on line 88