摘要:###摘要--- 1、STL的map底层是用红黑树实现的,查找时间复杂度是log(n); 2、STL的hash_map底层是用hash表存储的,查询时间复杂度是O(1); 3、什么时候用map,什么时候用hash_map? 这个要看具体的应用,不一定常数级别的hash_map...
阅读全文
随笔分类 - Java
摘要:###摘要--- 1、STL的map底层是用红黑树实现的,查找时间复杂度是log(n); 2、STL的hash_map底层是用hash表存储的,查询时间复杂度是O(1); 3、什么时候用map,什么时候用hash_map? 这个要看具体的应用,不一定常数级别的hash_map...
阅读全文
摘要:### Map can't be sorted by valueMap can't be sorted by value , so that we can change map to *List* and then sort the list .###Collections.sort( List l...
阅读全文
摘要:###why comparator ?* comparable : adj* comparator : nSome class can't be changed , which like Map , Set and their subclass . They are given being unch...
阅读全文
摘要:###1.add \ remove \ sort```import java.util.ArrayList;import java.util.Collections;import java.util.Comparator;public class listTest{ public static vo...
阅读全文
摘要:###entrySet() , values() and keySet()```import java.util.Iterator;import java.util.Map.Entry;import java.util.TreeMap;public class mapTest{ public sta...
阅读全文
摘要:### 简介中大型Java项目普遍需要调配许多参数,本文引入参数包,用系统快捷的方法管理参数。效果如下:```Poster [options...] [arguments...] -dictFile VAL : Specify file of dictionary -filterLemm...
阅读全文
|