GS Collections :一個Java集合框架
GS Collections是一個Java集合框架。它擁有兼容JDK的List,Set和Map實現。提供了豐富的API和一組工具類用于操作任何JDK兼容的Collections, Arrays, Maps 或 Strings。以下是一個示例代碼:
MutableList<Person> people = FastList.newListWith(person1, person2, person3); MutableList<String> sortedLastNames = people.collect(Person.TO_LAST_NAME).sortThis(); System.out.println("Comma separated, sorted last names: " + sortedLastNames.makeString());
為什么要使用GS Collections?
- 提高可讀性和減少重復迭代代碼
- 實現了幾個,高層次的迭代模式 (select, reject, collect, inject into, etc.)擴展自JDK接口的 “人性化”容器接口。
- 為 Collections, Arrays, Maps, 和 Strings提供了一個一致的迭代機制。
- 提供替代優化性能和內存使用的ArrayList,HashSet,HashMap。
- Performs more "behind-the-scene" optimizations in utility classes
- Encapsulates a lot of the structural complexity of parallel iteration and lazy evaluation
- Adds new containers including Bag, Interval, Multimap, and immutable versions of all types
- Has been under active development since 2005 and is a mature library </ul>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!