GS Collections :一个Java集合框架

jopen 11年前

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

项目主页:http://www.open-open.com/lib/view/home/1371378167828