Java Codecom.google.guava guava 12.0
... ... import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; ... ... BiMap<String, String> bimap = HashBiMap.create(); bimap.put("xxx", "123"); bimap.put("yyy", "456"); System.out.println(bimap.get("xxx")); //123 System.out.println(bimap.get("yyy")); //456 System.out.println(bimap.inverse().get("123")); //xxx System.out.println(bimap.inverse().get("456")); //yyy
ไม่มีความคิดเห็น:
แสดงความคิดเห็น