Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A supplement or replacement for the Java Collections Framework.
Java Scala
Branch: master

[GSCOLLECT-1618] Update version number in the pom.xml files.

git-svn-id: svn+ssh://gscollections.svn.services.gs.com/svnroot/gscollections-svn/trunk@860 d5c9223b-1aff-41ac-aadd-f810b4a99ac4
latest commit 3c097ae4f9
@motlin motlin authored
Failed to load latest commit information.
.idea [GSCOLLECT-1521] Fix the iteration order of several iteration patterns.
.settings [GSCOLLECT-35] Initial import.
acceptance-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
collections-api [GSCOLLECT-1618] Update version number in the pom.xml files.
collections-testutils [GSCOLLECT-1618] Update version number in the pom.xml files.
collections [GSCOLLECT-1618] Update version number in the pom.xml files.
gs-collections-code-generator-ant [GSCOLLECT-1618] Update version number in the pom.xml files.
gs-collections-code-generator-maven-plugin [GSCOLLECT-1618] Update version number in the pom.xml files.
gs-collections-code-generator [GSCOLLECT-1618] Update version number in the pom.xml files.
gs-collections-forkjoin [GSCOLLECT-1618] Update version number in the pom.xml files.
jmh-scala-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
jmh-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
junit-trait-runner [GSCOLLECT-1618] Update version number in the pom.xml files.
memory-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
performance-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
scala-unit-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
serialization-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
unit-tests-java8 [GSCOLLECT-1618] Update version number in the pom.xml files.
unit-tests [GSCOLLECT-1618] Update version number in the pom.xml files.
.classpath [GSCOLLECT-35] Initial import.
.gitignore [GSCOLLECT-625] Add .gitignore file.
.project [GSCOLLECT-35] Initial import.
.travis.yml [GSCOLLECT-1584] Configure Travis CI build.
LICENSE-2.0.txt [GSCOLLECT-35] Initial import.
NOTICE [GSCOLLECT-882] Add StringTemplate to the NOTICE file.
README.md [GSCOLLECT-1618] Update version number in the pom.xml files.
build.xml [GSCOLLECT-1325] Change test modules to use Java 8 and replace anonym…
checkstyle-configuration.xml [GSCOLLECT-1598] Reduce code duplication between multi-reader test tr…
checkstyle-suppressions.xml [GSCOLLECT-1547] Implement a JUnit Runner for interfaces containing c…
collections-parent.iml [GSCOLLECT-1278] Update versions of dependencies.
common-build.xml [GSCOLLECT-42] Configure deployment to Maven Central.
deploy.properties [GSCOLLECT-1617]: Commit build info for release.
findbugs-exclude.xml [GSCOLLECT-1521] Fix the iteration order of several iteration patterns.
java.header [GSCOLLECT-898] Change the CheckStyle header regular expression to al…
pom-template [GSCOLLECT-42] Configure deployment to Maven Central.
pom.xml [GSCOLLECT-1618] Update version number in the pom.xml files.
version.properties [GSCOLLECT-1594] Update versions of dependencies.

README.md

GS Collections

GS Collections is a collections framework for Java. It has JDK-compatible List, Set and Map implementations with a rich API and set of utility classes that work with any JDK compatible Collections, Arrays, Maps or Strings. The iteration protocol was inspired by the Smalltalk collection framework.

Quick Example

GS Collections puts iteration methods on the container types. Lambdas are simulated using anonymous inner classes. Here's a code example that demonstrates the usual style of programming with GS Collections.

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());

Person.TO_LAST_NAME is defined as a constant Function in the Person class.

public static final Function<Person, String> TO_LAST_NAME = new Function<Person, String>()
{
    public String valueOf(Person person)
    {
        return person.lastName;
    }
};

In Java 8, the Function can be replaced with a lambda:

MutableList<String> sortedLastNames = people.collect(person -> person.getLastName()).sortThis();

Or, a method reference:

MutableList<String> sortedLastNames = people.collect(Person::getLastName).sortThis();

Why GS Collections?

  • Improves readability and reduces duplication of iteration code (enforces DRY/OAOO)
  • Implements several, high-level iteration patterns (select, reject, collect, inject into, etc.) on "humane" container interfaces which are extensions of the JDK interfaces
  • Provides a consistent mechanism for iterating over Collections, Arrays, Maps, and Strings
  • Provides replacements for ArrayList, HashSet, and HashMap optimized for performance and memory usage
  • 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

Documentation

The best way to learn about GS Collections is to dive into the code kata. The kata is a fun way to learn idiomatic GS Collections usage and hone your skills through practice.

For more comprehensive documentation, take a look at the Reference Guide.

Contributions

We currently do all development in an internal Subversion repository and are not prepared to take external contributions. However, we watch the issue tracker for bug reports and feature requests.

FAQ

Why is Goldman Sachs open-sourcing GS Collections?

  • We believe that GS Collections offers a significant advantage over existing solutions. We hope others will benefit from it.
  • We believe in the power of the technical community to help improve GS Collections.
  • Technology is a huge part of what we do at Goldman Sachs. GS Collections exemplifies our commitment to technology.
  • We use open source software in many of our operations. We have benefited from the work of others and we'd like to give something back.

Does Goldman Sachs use GS Collections?

Yes, we use GS Collections in many of our internal applications.

Acquiring GS Collections

Download

Maven

<dependency>
  <groupId>com.goldmansachs</groupId>
  <artifactId>gs-collections-api</artifactId>
  <version>6.2.0</version>
</dependency>

<dependency>
  <groupId>com.goldmansachs</groupId>
  <artifactId>gs-collections</artifactId>
  <version>6.2.0</version>
</dependency>

<dependency>
  <groupId>com.goldmansachs</groupId>
  <artifactId>gs-collections-testutils</artifactId>
  <version>6.2.0</version>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>com.goldmansachs</groupId>
  <artifactId>gs-collections-forkjoin</artifactId>
  <version>6.2.0</version>
</dependency>

Gradle

compile 'com.goldmansachs:gs-collections-api:6.2.0'
compile 'com.goldmansachs:gs-collections:6.2.0'
testCompile 'com.goldmansachs:gs-collections-testutils:6.2.0'
compile 'com.goldmansachs:gs-collections-forkjoin:6.2.0'

Ivy

<dependency org="com.goldmansachs" name="gs-collections-api" rev="6.2.0" />
<dependency org="com.goldmansachs" name="gs-collections" rev="6.2.0" />
<dependency org="com.goldmansachs" name="gs-collections-testutils" rev="6.2.0" />
<dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="6.2.0"/>
Something went wrong with that request. Please try again.