用map实现数据字典功能
生活随笔
收集整理的這篇文章主要介紹了
用map实现数据字典功能
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
在網上看了挺多,就是找不到具體的如何用map實現數據字典。自己寫了一個記錄一下、
?
import java.util.HashMap; import java.util.Map;public class code {static Map<String, String> map = new HashMap<String, String>();static{map.put("999", "www.baidu.com");}public String returnCodeByUrl(String url){for(Map.Entry<String, String> entry: map.entrySet()){if(entry.getValue().equals(url)){return entry.getKey();}}return null;} }?
?
轉載于:https://my.oschina.net/yuhangyes/blog/1836296
總結
以上是生活随笔為你收集整理的用map实现数据字典功能的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html2canvas的踩坑之路
- 下一篇: 管窥MVVMLight Command参