JAVA_HashMap運作_Set觀念補充_無序的潛藏陷阱
HashMap會去透過對應一組Key跟Value來做一個值的map存放。 key存在與不存在時的對應值回傳 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hashmapapp; import java.util.HashMap ; /** * * @author chous */ public class HashMapApp { /** * @param args the command line arguments */ public static void main (String[] args) { // TODO code application logic here HashMap<Integer,String> map = new HashMap<Integer,String>(); map. put ( 5 , "Five" ); map. put ( 8 , "Eight" ); map. put ( 6 , "Six" ); map. put ( 4 , "Four" ); map. put ( 2 , "Two" ); String resultIsExist = map. get ( 4 ); Syste