GS Collections has been migrated to the Eclipse Foundation, re-branded as Eclipse Collections. https://www.eclipse.org/collections/

Overview

GS Collections is now Eclipse Collections

We are pleased to announce that GS Collections has been migrated to the Eclipse Foundation, re-branded as Eclipse Collections.

Eclipse Collections 7.0 has the exact same feature set as GS Collections 7.0.

Going forward, any new features will be developed in Eclipse Collections. We will only port critical bug fixes to GS Collections. To support smooth migration for users, we implemented a conversion application gsc-ec-converter. Please plan your migration accordingly from GS Collections to Eclipse Collections.

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. The library modules in GS Collections are compatible with Java 5 (gs-collections-api, gs-collections, and gs-collections-testutils).

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, BiMap, 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. Please refer to the wiki for more details.

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>7.0.0</version>
</dependency>

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

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

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

Gradle

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

Ivy

<dependency org="com.goldmansachs" name="gs-collections-api" rev="7.0.0" />
<dependency org="com.goldmansachs" name="gs-collections" rev="7.0.0" />
<dependency org="com.goldmansachs" name="gs-collections-testutils" rev="7.0.0" />
<dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="7.0.0"/>
Comments
  • StringIterate.csvTokensTo* methods lack support for quoted  field

    StringIterate.csvTokensTo* methods lack support for quoted field

    csv is not as simple as StringIterate.tokensToList(string, ",");, a csv parser should be able to support quoted field which means comma within double quoted field should not be treated as a delimit.

    test case:

    String str = "a, b,\ "c,d""; Verify.assertListsEqual(FastList.newListWith("a", "b", "c,d"), StringIterate.csvTokensToList(str));

    opened by ShijunK 4
  • Inefficient list.clear() methods

    Inefficient list.clear() methods

    Maybe there is a reason for this that I am missing, but it seems like the 'clear()' method for the List classes are very wasteful. For FastList, the .clear() method nulls the entire inner array regardless of what the size of the list is. As a result, the clear() method takes times proportional to the space allocated, not the size of the list.

    This can cause severe performance degradation for some use patterns. For example, if you add one million elements to a FastList, clear that list, then add one element to the list, then clear it again, the second call to clear() will walk through and set to null the entire 1 million length internal array even though the size of the list is actually 1. Instead the clear method should only reset size elements of the inner array, as is done by java.util.ArrayList.

    This issues seems to affect primitive lists as well. For primitive ArrayLists, the clear method should just be able to set size to 0 since nothing needs to be GCed, instead the entire internal array is overwritten.

    opened by chrisc36 3
  • ArrayIndexOutOfBoundsException while iterating over UnifiedMap

    ArrayIndexOutOfBoundsException while iterating over UnifiedMap

    I was iterating over a unifiedMap using values view and hit an ArrayIndexOutOfBoundsException

    for (Object o : unifiedMap.valuesView()) 
    

    | |

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1048576
        at com.gs.collections.impl.map.mutable.UnifiedMap$ValuesIterator.next(UnifiedMap.java:2564)
        at com.gs.collections.impl.UnmodifiableIteratorAdapter.next(UnmodifiableIteratorAdapter.java:42)
        at com.gs.futures.lexicon.product.client.components.InstrumentCache.unionOfChildMapsAsInstrumentList(InstrumentCache.java:471)
    
    opened by yeison 3
  • IntArrayList (and friends)'s sortThis assume the collection is trimmed

    IntArrayList (and friends)'s sortThis assume the collection is trimmed

        @Test
        public void testArrayListSortThis() {
            final IntArrayList list = new IntArrayList();
            list.add(6);
            list.add(5);
            list.sortThis();
            assertEquals(5, list.get(0));
        }
    
    Expected :5
    Actual   :0
    

    The internal array in IntArrayList, after this set of operations, is:

    new int[] { 0,0,0,0,0,0,0,0,5,6 }
    

    Fix?

        public IntArrayList sortThis()
        {
            Arrays.sort(this.items, 0, this.size);
            return this;
        }
    
    opened by FauxFaux 3
  • Avoid double probe

    Avoid double probe

    Another performance issue, I can look into patching this on the Eclipse Collections project as well.

    For, primitive object maps, "ObjectHashMap" the "getIfAbsent" method calls the probe function twice, basically doubling the cost of a hash lookup. The problem are the lines:

            int index = this.probe(key);
            if (this.keys[this.probe(key)] == key)
    

    the precomputed index value is recomputed from scratch on the second line!

    opened by chrisc36 2
  • JDK 7 build?

    JDK 7 build?

    I have been trying to build gs-collections, but master, and tags 5.1.0 and 5.0.0 all require JDK 8. Is there a version that doesn't require JDK 8? I would like to do some testing with this for possible use.

    opened by andrigtmiller 2
  • Bump ant from 1.9.4 to 1.9.15 in /gs-collections-code-generator-ant

    Bump ant from 1.9.4 to 1.9.15 in /gs-collections-code-generator-ant

    Bumps ant from 1.9.4 to 1.9.15.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump checkstyle from 6.11.1 to 8.18 in /collections

    Bump checkstyle from 6.11.1 to 8.18 in /collections

    Bumps checkstyle from 6.11.1 to 8.18.

    Release notes

    Sourced from checkstyle's releases.

    checkstyle-8.18

    https://checkstyle.org/releasenotes.html#Release_8.18

    checkstyle-8.17

    https://checkstyle.org/releasenotes.html#Release_8.17

    checkstyle-8.16

    https://checkstyle.org/releasenotes.html#Release_8.16

    checkstyle-8.15

    https://checkstyle.org/releasenotes.html#Release_8.15

    checkstyle-8.14

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.14

    checkstyle-8.13

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.13

    checkstyle-8.12

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.12

    checkstyle-8.11

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.11

    checkstyle-8.10.1

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10.1

    checkstyle-8.10

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10

    checkstyle-8.9

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.9

    checkstyle-8.8

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.8

    Maven artifacts: http://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/8.8/

    checkstyle-8.7

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.7

    checkstyle-8.6

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.6

    checkstyle-8.5

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.5

    checkstyle-8.4

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.4

    ... (truncated)
    Commits
    • 252d29b [maven-release-plugin] prepare release checkstyle-8.18
    • 385b64a minor: fix typo in comment
    • e77ec1c doc: add releasenotes 8.18
    • 180b4fe Issue #6474: disable external dtd load by default
    • 59413ca minor: changed powermock tests to normal tests for TranslationCheck
    • 906adae Issue #4814: added try/catch to setting up TreeWalker children
    • 4b8e508 minor: changed powermock tests to normal tests
    • 86dcb80 Issue #6439: move powermock tests away from the normal tests
    • 96385e2 Issue #6440: AnnotationLocation: named parameters must be considered parameters
    • 404143c Issue #6301: ArrayTypeStyle support for method definitions
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump checkstyle from 6.11.1 to 8.18 in /gs-collections-code-generator

    Bump checkstyle from 6.11.1 to 8.18 in /gs-collections-code-generator

    Bumps checkstyle from 6.11.1 to 8.18.

    Release notes

    Sourced from checkstyle's releases.

    checkstyle-8.18

    https://checkstyle.org/releasenotes.html#Release_8.18

    checkstyle-8.17

    https://checkstyle.org/releasenotes.html#Release_8.17

    checkstyle-8.16

    https://checkstyle.org/releasenotes.html#Release_8.16

    checkstyle-8.15

    https://checkstyle.org/releasenotes.html#Release_8.15

    checkstyle-8.14

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.14

    checkstyle-8.13

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.13

    checkstyle-8.12

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.12

    checkstyle-8.11

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.11

    checkstyle-8.10.1

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10.1

    checkstyle-8.10

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10

    checkstyle-8.9

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.9

    checkstyle-8.8

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.8

    Maven artifacts: http://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/8.8/

    checkstyle-8.7

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.7

    checkstyle-8.6

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.6

    checkstyle-8.5

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.5

    checkstyle-8.4

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.4

    ... (truncated)
    Commits
    • 252d29b [maven-release-plugin] prepare release checkstyle-8.18
    • 385b64a minor: fix typo in comment
    • e77ec1c doc: add releasenotes 8.18
    • 180b4fe Issue #6474: disable external dtd load by default
    • 59413ca minor: changed powermock tests to normal tests for TranslationCheck
    • 906adae Issue #4814: added try/catch to setting up TreeWalker children
    • 4b8e508 minor: changed powermock tests to normal tests
    • 86dcb80 Issue #6439: move powermock tests away from the normal tests
    • 96385e2 Issue #6440: AnnotationLocation: named parameters must be considered parameters
    • 404143c Issue #6301: ArrayTypeStyle support for method definitions
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump checkstyle from 6.11.1 to 8.18 in /gs-collections-code-generator-maven-plugin

    Bump checkstyle from 6.11.1 to 8.18 in /gs-collections-code-generator-maven-plugin

    Bumps checkstyle from 6.11.1 to 8.18.

    Release notes

    Sourced from checkstyle's releases.

    checkstyle-8.18

    https://checkstyle.org/releasenotes.html#Release_8.18

    checkstyle-8.17

    https://checkstyle.org/releasenotes.html#Release_8.17

    checkstyle-8.16

    https://checkstyle.org/releasenotes.html#Release_8.16

    checkstyle-8.15

    https://checkstyle.org/releasenotes.html#Release_8.15

    checkstyle-8.14

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.14

    checkstyle-8.13

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.13

    checkstyle-8.12

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.12

    checkstyle-8.11

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.11

    checkstyle-8.10.1

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10.1

    checkstyle-8.10

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10

    checkstyle-8.9

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.9

    checkstyle-8.8

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.8

    Maven artifacts: http://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/8.8/

    checkstyle-8.7

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.7

    checkstyle-8.6

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.6

    checkstyle-8.5

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.5

    checkstyle-8.4

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.4

    ... (truncated)
    Commits
    • 252d29b [maven-release-plugin] prepare release checkstyle-8.18
    • 385b64a minor: fix typo in comment
    • e77ec1c doc: add releasenotes 8.18
    • 180b4fe Issue #6474: disable external dtd load by default
    • 59413ca minor: changed powermock tests to normal tests for TranslationCheck
    • 906adae Issue #4814: added try/catch to setting up TreeWalker children
    • 4b8e508 minor: changed powermock tests to normal tests
    • 86dcb80 Issue #6439: move powermock tests away from the normal tests
    • 96385e2 Issue #6440: AnnotationLocation: named parameters must be considered parameters
    • 404143c Issue #6301: ArrayTypeStyle support for method definitions
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump checkstyle from 6.11.1 to 8.18 in /collections-api

    Bump checkstyle from 6.11.1 to 8.18 in /collections-api

    Bumps checkstyle from 6.11.1 to 8.18.

    Release notes

    Sourced from checkstyle's releases.

    checkstyle-8.18

    https://checkstyle.org/releasenotes.html#Release_8.18

    checkstyle-8.17

    https://checkstyle.org/releasenotes.html#Release_8.17

    checkstyle-8.16

    https://checkstyle.org/releasenotes.html#Release_8.16

    checkstyle-8.15

    https://checkstyle.org/releasenotes.html#Release_8.15

    checkstyle-8.14

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.14

    checkstyle-8.13

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.13

    checkstyle-8.12

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.12

    checkstyle-8.11

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.11

    checkstyle-8.10.1

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10.1

    checkstyle-8.10

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.10

    checkstyle-8.9

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.9

    checkstyle-8.8

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.8

    Maven artifacts: http://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/8.8/

    checkstyle-8.7

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.7

    checkstyle-8.6

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.6

    checkstyle-8.5

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.5

    checkstyle-8.4

    http://checkstyle.sourceforge.net/releasenotes.html#Release_8.4

    ... (truncated)
    Commits
    • 252d29b [maven-release-plugin] prepare release checkstyle-8.18
    • 385b64a minor: fix typo in comment
    • e77ec1c doc: add releasenotes 8.18
    • 180b4fe Issue #6474: disable external dtd load by default
    • 59413ca minor: changed powermock tests to normal tests for TranslationCheck
    • 906adae Issue #4814: added try/catch to setting up TreeWalker children
    • 4b8e508 minor: changed powermock tests to normal tests
    • 86dcb80 Issue #6439: move powermock tests away from the normal tests
    • 96385e2 Issue #6440: AnnotationLocation: named parameters must be considered parameters
    • 404143c Issue #6301: ArrayTypeStyle support for method definitions
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • Bump logback-classic from 1.1.3 to 1.2.0 in /performance-tests

    Bump logback-classic from 1.1.3 to 1.2.0 in /performance-tests

    Bumps logback-classic from 1.1.3 to 1.2.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump logback-classic from 1.1.3 to 1.2.0 in /memory-tests

    Bump logback-classic from 1.1.3 to 1.2.0 in /memory-tests

    Bumps logback-classic from 1.1.3 to 1.2.0.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump ant from 1.9.4 to 1.10.9 in /gs-collections-code-generator-ant

    Bump ant from 1.9.4 to 1.10.9 in /gs-collections-code-generator-ant

    Bumps ant from 1.9.4 to 1.10.9.

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump junit from 4.12 to 4.13.1 in /collections-testutils

    Bump junit from 4.12 to 4.13.1 in /collections-testutils

    Bumps junit from 4.12 to 4.13.1.

    Release notes

    Sourced from junit's releases.

    JUnit 4.13.1

    Please refer to the release notes for details.

    JUnit 4.13

    Please refer to the release notes for details.

    JUnit 4.13 RC 2

    Please refer to the release notes for details.

    JUnit 4.13 RC 1

    Please refer to the release notes for details.

    JUnit 4.13 Beta 3

    Please refer to the release notes for details.

    JUnit 4.13 Beta 2

    Please refer to the release notes for details.

    JUnit 4.13 Beta 1

    Please refer to the release notes for details.

    Commits
    • 1b683f4 [maven-release-plugin] prepare release r4.13.1
    • ce6ce3a Draft 4.13.1 release notes
    • c29dd82 Change version to 4.13.1-SNAPSHOT
    • 1d17486 Add a link to assertThrows in exception testing
    • 543905d Use separate line for annotation in Javadoc
    • 510e906 Add sub headlines to class Javadoc
    • 610155b Merge pull request from GHSA-269g-pwp5-87pp
    • b6cfd1e Explicitly wrap float parameter for consistency (#1671)
    • a5d205c Fix GitHub link in FAQ (#1672)
    • 3a5c6b4 Deprecated since jdk9 replacing constructor instance of Double and Float (#1660)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump junit from 4.12 to 4.13.1

    Bump junit from 4.12 to 4.13.1

    Bumps junit from 4.12 to 4.13.1.

    Release notes

    Sourced from junit's releases.

    JUnit 4.13.1

    Please refer to the release notes for details.

    JUnit 4.13

    Please refer to the release notes for details.

    JUnit 4.13 RC 2

    Please refer to the release notes for details.

    JUnit 4.13 RC 1

    Please refer to the release notes for details.

    JUnit 4.13 Beta 3

    Please refer to the release notes for details.

    JUnit 4.13 Beta 2

    Please refer to the release notes for details.

    JUnit 4.13 Beta 1

    Please refer to the release notes for details.

    Commits
    • 1b683f4 [maven-release-plugin] prepare release r4.13.1
    • ce6ce3a Draft 4.13.1 release notes
    • c29dd82 Change version to 4.13.1-SNAPSHOT
    • 1d17486 Add a link to assertThrows in exception testing
    • 543905d Use separate line for annotation in Javadoc
    • 510e906 Add sub headlines to class Javadoc
    • 610155b Merge pull request from GHSA-269g-pwp5-87pp
    • b6cfd1e Explicitly wrap float parameter for consistency (#1671)
    • a5d205c Fix GitHub link in FAQ (#1672)
    • 3a5c6b4 Deprecated since jdk9 replacing constructor instance of Double and Float (#1660)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump junit from 4.12 to 4.13.1 in /jmh-scala-tests

    Bump junit from 4.12 to 4.13.1 in /jmh-scala-tests

    Bumps junit from 4.12 to 4.13.1.

    Release notes

    Sourced from junit's releases.

    JUnit 4.13.1

    Please refer to the release notes for details.

    JUnit 4.13

    Please refer to the release notes for details.

    JUnit 4.13 RC 2

    Please refer to the release notes for details.

    JUnit 4.13 RC 1

    Please refer to the release notes for details.

    JUnit 4.13 Beta 3

    Please refer to the release notes for details.

    JUnit 4.13 Beta 2

    Please refer to the release notes for details.

    JUnit 4.13 Beta 1

    Please refer to the release notes for details.

    Commits
    • 1b683f4 [maven-release-plugin] prepare release r4.13.1
    • ce6ce3a Draft 4.13.1 release notes
    • c29dd82 Change version to 4.13.1-SNAPSHOT
    • 1d17486 Add a link to assertThrows in exception testing
    • 543905d Use separate line for annotation in Javadoc
    • 510e906 Add sub headlines to class Javadoc
    • 610155b Merge pull request from GHSA-269g-pwp5-87pp
    • b6cfd1e Explicitly wrap float parameter for consistency (#1671)
    • a5d205c Fix GitHub link in FAQ (#1672)
    • 3a5c6b4 Deprecated since jdk9 replacing constructor instance of Double and Float (#1660)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(7.0.3)
  • 7.0.3(Mar 16, 2016)

    Bug Fixes

    • Fixed memory leak in HashBiMap.
    • Fixed incorrect code path in key collision handling and keyset iterator based remove operation in primitive Maps with Hashing Strategy.

    Acquiring Eclipse Collections

    Maven

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

    Gradle

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="7.0.3" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="7.0.3" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="7.0.3" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="7.0.3"/>
    
    Source code(tar.gz)
    Source code(zip)
  • 7.0.1(Mar 16, 2016)

    Bug Fixes

    Fixed UnifiedSet.ChainedBucket.removeLongChain() method to handle many collisions in one bucket.

    Acquiring Eclipse Collections

    Maven

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

    Gradle

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="7.0.1" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="7.0.1" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="7.0.1" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="7.0.1"/>
    
    Source code(tar.gz)
    Source code(zip)
  • 7.0.0(Nov 4, 2015)

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="7.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="7.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="7.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="7.0.0"/>
    

    Breaking Changes

    • MutableCollection.removeIf() now returns boolean.
    • Sorted sets, bags, and maps implement ReversibleIterable. Added OrderedMap interface to represent a linked hash map.
    • Overrode BiMap.partition() to return PartitionUnsortedSet.
    • UnifiedMap and UnifiedSet now throw if constructed with a load factor greater than 1.
    • toStringOfItemToCount() in ImmutableEmptyBag now consistent with other Bags. Returns "{}" instead of ""

    New Functionality

    Primitive Collections

    <Primitive>List.binarySearch() Fixes #20

    ObjectPrimitiveHashMapWithHashingStrategy

    Similar to ObjectPrimitiveHashMap but uses a HashingStrategy to hash and compare keys. Analogous to UnifiedMapWithHashingStrategy.

    <Primitive>Iterable.each()

    Behaves exactly same as <Primitive>Iterable.forEach(). Added to be in sync with RichIterable.each(Procedure) that was introduced in 6.0 to avoid ambiguity conflict with Iterable.forEach(Consumer).

    Lazy<Primitive>Iterable.collect<Primitive>()

    aggregateInPlaceBy(), aggregateBy(), zip(), zipWithIndex(), partition(), selectInstancesOf(), collectIf(), groupBy(), and groupByEach() on MutablePrimitiveObjectMap

    Use the Kahan summation algorithm on sum() and sumBy() methods on primitive collections

    Other new Functionality

    CharAdapter, CodePointAdapter and CodePointList

    • CharAdapter implements CharSequence and ImmutableCharList, and it represents String as a collection of char values.
    • CharPointAdapter implements CharSequence and ImmutableIntList. It behaves similarly to CharAdapter but it represents String as the unicode codepoint values that are ints.
    • CharPointList is similar to CharPointAdapter but it calculates and caches the unicode code point values as an ImmutableIntList internally.
    CharAdapter chars = CharAdapter.adapt("This is an example");
    CodePointAdapter codePoints = CodePointAdapter.adapt("Can you read this Kanji \"\uD840\uDC00\"? I cannot.");
    CodePointList codePointList = CodePointList.from("BMP stands for Basic Multilingual Pane. \"\uD840\uDC00\" is a unicode character outside BMP.");
    
    System.out.println("Upper case: " + chars.collectChar(Character::toUpperCase));
    System.out.println("Unicode character outside Basic Multilingual Pane: " + codePoints.reject(Character::isBmpCodePoint).distinct());
    System.out.println("English only: " + codePointList.reject(Character::isIdeographic));
    

    Prints

    Upper case: THIS IS AN EXAMPLE
    Unicode character outside Basic Multilingual Pane: 𠀀
    English only: BMP stands for Basic Multilingual Pane. "" is a unicode character outside BMP.
    

    ImmutableSortedBag

    ListIterable.distinct(HashingStrategy)

    Returns a new ListIterable containing the distinct elements in this list. Conceptually similar to new UnifiedSetWithHashingStrategy(hashingStrategy, listIterable).toList() but retains the original order.

    MutableBagMultimap.putOccurrences(K key, V value, int occurrences)

    Adds occurrences of value to the MutableBag at key in the multimap.

    MutableList.shuffleThis(): MutableList

    Shuffles this list and returns this list. Overload optionally takes a Random.

    Predicates.cast() and Functions.cast()

    Allows a Java 8 lambda or method reference to be used in a method taking a predicate or a function without requiring a cast. The methods can be used in places where two or more method overloads could apply when used with a lambda or method reference.

    Lists.mutable.of(1, 2, null).removeIf(each -> each == null);
    

    This code fails to compile with the following error.

    Error: java: reference to removeIf is ambiguous
    both method removeIf(java.util.function.Predicate<? super E>) in java.util.Collection and method removeIf(com.gs.collections.api.block.predicate.Predicate<? super T>) in com.gs.collections.api.collection.MutableCollection match
    

    You can work around the problem by using a cast or the method Predicates.cast().

    Lists.mutable.of(1, 2, null).removeIf(Predicates.cast(each -> each == null));
    

    Add factory method for creating mutable sets and maps of a given initial capacity.

    For example: Sets.mutable.withInitialCapacity(100)

    Optimizations and Performance Tests

    • Optimize FastList.addAll() and UnifiedSet.addAll() for RandomAccess lists.
    • Optimize UnifiedMap's short-circuit methods to not delegate to an iterator.
    • Refactor ImmutableSortedBag.newWith() and newWithout() to take O(n) time.
    • Add JDK 8 Streams based JMH tests for FastList.
    • Add JMH Tests for HashMap<Integer, Integer>

    Bug Fixes

    • Fix bug in CollectIterable.toArray() where it returns T[] instead of Object[].
    • Fix iterator's remove() method in ObjectPrimitiveHashMap so that it doesn't rehash.
    • Fix code point iteration in StringIterate and provide CharAdapter and CodePointList as OO alternatives for string iteration.

    Documentation and Deprecation

    • Add information about required Java versions to README.md. Fixes #18.
    • Enhance Javadoc of Iterate.
    • Update Javadoc in InternalIterable and RichIterable to include Java 8 lambda examples.
    • Deprecate ArrayIterate.sort() and recommend direct calls to Arrays.sort().
    • Deprecate overloaded methods in StringIterate and add specialization alternatives that work better with Java 8 lambdas.
    Source code(tar.gz)
    Source code(zip)
  • 6.2.0(Jun 9, 2015)

    Binaries

    gs-collections-6.2.0.zip

    Javadoc

    6.2.0 Javadoc

    Acquiring GS Collections

    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>
    

    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"/>
    

    Optimizations

    • Improve primitive map performance.
    • Optimize addAll/removeAll on HashBag when a Bag is passed as the parameter.

    Bug Fixes

    • Fix bug in remove() in HashBag's iterator.
    • Fix bug in remove() in HashBag and TreeBag's iterators.
    Source code(tar.gz)
    Source code(zip)
  • 6.1.0(Mar 25, 2015)

    Binaries

    gs-collections-6.1.0.zip

    Javadoc

    6.1.0 Javadoc

    JDiff

    Differences between 6.0.0 and 6.1.0

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="6.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="6.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="6.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="6.1.0"/>
    

    New Functionality

    Travis CI build

    A continuous build runs at travis-ci and its status is reflected in the README badge.

    Allow ArrayList to have subclasses.

    Fixes #19.

    ParallelIterable.flatCollect()

    Optimizations

    • Optimize ArrayList.addAll(PrimitiveIterable) to avoid an array copy when the parameter is also a ArrayList. Fixes #19.
    • Optimize primitive maps/sets probing method.

    Bug Fixes

    • Fix size() on the views of ConcurrentHashMap.
    • Fix the iteration order of several iteration patterns.

    Performance and memory tests

    Many new performance and memory tests supporting the material in the presentation "Scala Collections Performance" at Scala Days San Francisco 2015. There are new JMH tests for several lists, sorted sets, and maps as well as new memory tests for several sets and maps.

    Source code(tar.gz)
    Source code(zip)
  • 6.0.0(Feb 9, 2015)

    Binaries

    gs-collections-6.0.0.zip

    Javadoc

    6.0.0 Javadoc

    JDiff

    Differences between 5.1.0 and 6.0.0

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="6.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="6.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="6.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="6.0.0"/>
    

    New Functionality

    RichIterable API

    RichIterable.each(Procedure)

    Java 8 introduced Iterable.forEach(Consumer) which can cause problems for users of RichIterable.forEach(Procedure). Consumer and Procedure have the same shape, so passing in a lambda is ambiguous.

    FastList.newListWith(1, 2, 3).forEach(System.out::println);
    

    This code fails with the following compiler error.

    Error: reference to forEach is ambiguous
            both method forEach(java.util.function.Consumer<? super T>) in java.lang.Iterable
            and method forEach(com.gs.collections.api.block.procedure.Procedure<? super T>) in com.gs.collections.impl.list.mutable.FastList match
    

    You can work around this problem by using a cast, Procedures.cast(), or by using RichIterable.each(Procedure) which behaves exactly like InternalIterable.forEach(Procedure).

    FastList.newListWith(1, 2, 3).forEach((Procedure<? super Integer>) System.out::println);
    FastList.newListWith(1, 2, 3).forEach(Procedures.cast(System.out::println));
    FastList.newListWith(1, 2, 3).each(System.out::println);
    

    RichIterable.tap(Procedure): RichIterable

    Executes the Procedure for each element in the iterable and returns the RichIterable. Similar to RichIterable.forEach(Procedure) and RichIterable.each(Procedure) but returns this.

    LazyIterable.tap(Procedure): LazyIterable

    LazyIterable.tap(Procedure) overrides RichIterable.tap(Procedure) and executes lazily. It is useful to "tap into" a method chain, executing a Procedure on every element of the LazyIterable without ending the chain or forcing evaluation.

    RichIterable<String> list = Lists.mutable.of("One", "Two", "Three", "Four");
    
    list.asLazy()
        .tap(each -> System.out.println(each + " --(Each element prints this)"))
        .select(StringPredicates.contains("o"))
        .tap(selected -> System.out.println(selected + " --(Only selected element prints this)"))
        .collect(String::toUpperCase)
        .tap(collected -> System.out.println(collected + " --(Collected element prints this)"))
        .each(a -> {}); // force evaluation
    

    Prints

    One --(Each element prints this)
    Two --(Each element prints this)
    Two --(Only selected element prints this)
    TWO --(Collected element prints this)
    Three --(Each element prints this)
    Four --(Each element prints this)
    Four --(Only selected element prints this)
    FOUR --(Collected element prints this)
    

    RichIterable.toSortedBag(), RichIterable.toSortedBag(Comparator), and RichIterable toSortedBagBy(Function)

    RichIterable.toSortedBag() converts the collection to a MutableSortedBag implementation and sorts it using the natural order of the elements. RichIterable.toSortedBag(Comparator) sorts using the Comparator parameter. RichIterable.toSortedBagBy(Function) sorts based on the natural order of the attribute returned by the Function parameter.

    RichIterable.groupByUniqueKey(Function): MapIterable.

    Similar to RichIterable.groupBy(Function). The keys returned by the Function must be unique, otherwise an exception is thrown. Since the keys are unique, groupByUniqueKey() returns a MapIterable instead of a Multimap.

    RichIterable.sumBy(Int|Long|Float|Double)

    • RichIterable.sumByInt(Function<T, V> groupBy, IntFunction<? super T> function): ObjectLongMap<V>
    • RichIterable.sumByLong(Function<T, V> groupBy, LongFunction<? super T> function): ObjectLongMap<V>
    • RichIterable.sumByFloat(Function<T, V> groupBy, FloatFunction<? super T> function): ObjectDoubleMap<V>
    • RichIterable.sumByDouble(Function<T, V> groupBy, DoubleFunction<? super T> function): ObjectDoubleMap<V>

    Groups the elements in the RichIterable by the groupBy Function. Each group is converted to numbers using the primitive function and then summed. sumByInt() and sumByLong() return ObjectLongMap. sumByFloat() and sumByDouble() return ObjectDoubleMap.

    OrderedIterable API

    OrderedIterable interface for order dependent functionality.

    An OrderedIterable is a RichIterable with some meaningful order, such as insertion order, access order, or sorted order. ReversibleIterable and SortedIterable now extend OrderedIterable.

    Several methods were pulled up to OrderedIterable.

    • indexOf(Object)
    • takeWhile(Predicate), dropWhile(Predicate), and partitionWhile(Predicate)
    • distinct()
    • toStack()

    Other methods on InternalIterable and RichIterable are now deprecated because they imply a meaningful order which not all containers have. These methods are overridden on OrderedIterable so that the deprecation warning will not appear on ordered collections.

    • getFirst() and getLast()
    • forEach(startIndex, endIndex, procedure)
    • forEachWithIndex(ObjectIntProcedure)
    • forEachWithIndex(fromIndex, toIndex, objectIntProcedure)

    OrderedIterable.corresponds(OrderedIterable, Predicate2).

    Returns true if both OrderedIterables have the same length and the predicate returns true for all elements e1 of the current OrderedIterable and e2 of the other OrderedIterable.

    The predicate is evaluated for pairs of elements at the same position in both OrderedIterables. The corresponds() method short circuits as soon as it finds a pair of elements which do not correspond.

    MutableList<Integer> integers1 = FastList.newListWith(1, 2, 2, 3, 3, 3, 4, 4, 4, 4);
    MutableList<Integer> integers2 = FastList.newListWith(2, 3, 3, 4, 4, 4, 5, 5, 5, 5);
    Assert.assertTrue(integers1.corresponds(integers3, Predicates2.lessThan()));
    

    OrderedIterable.detectIndex(Predicate).

    Returns the index of the first element which satisfies the Predicate or -1 if no elements do. The detectIndex() method short circuits as soon as it finds an element which satisfies the Predicate.

    ListIterable<Integer> list = FastList.newListWith(1, 1, 2, 2, 3, 3);
    Assert.assertEquals(2, list.detectIndex(integer -> integer == 2));
    Assert.assertEquals(-1, list.detectIndex(integer -> integer == 4));
    

    ReversibleIterable API

    ReversibleIterable.detectLastIndex(Predicate).

    Returns the index of the last element which satisfies the Predicate or -1 if no elements do. The detectLastIndex() method iterates in reverse order and short circuits as soon as it finds an element which satisfies the Predicate.

    ListIterable<Integer> list = FastList.newListWith(1, 1, 2, 2, 3, 3);
    Assert.assertEquals(3, list.detectLastIndex(integer -> integer == 2));
    Assert.assertEquals(-1, list.detectLastIndex(integer -> integer == 4));
    

    ReversibleIterable.distinct().

    Same as ReversibleIterable.distinct() for primitive collections.

    ReversibleIterable.take(int n) and ReversibleIterable.drop(int n).

    take()

    Returns the first n elements of the iterable or all the elements in the iterable if n is greater than the length of the iterable.

    MutableList<Integer> list = FastList.newListWith(1, 2, 3, 4, 5);
    Assert.assertEquals(FastList.newList(), list.take(0));
    Assert.assertEquals(FastList.newListWith(1, 2, 3), list.take(3));
    Assert.assertEquals(FastList.newListWith(1, 2, 3, 4, 5), list.take(6));
    

    drop()

    Returns an iterable after skipping the first n elements or an empty iterable if n is greater than the length of the iterable.

    MutableList<Integer> list = FastList.newListWith(1, 2, 3, 4, 5);
    Assert.assertEquals(FastList.newListWith(1, 2, 3, 4, 5), list.drop(0));
    Assert.assertEquals(FastList.newListWith(4, 5), list.drop(3));
    Assert.assertEquals(FastList.newListWith(), list.drop(6));
    

    ParallelIterable API

    ListIterable.asParallel(), SetIterable.asParallel(), and SortedSetIterable.asParallel().

    In 5.0, asParallel() was added to FastList and UnifiedSet. Now it's on the interfaces ListIterable, SetIterable and SortedSetIterable as well.

    ListIterable<Person> people = ...;
    ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
    int batchSize = 10_000;
    ParallelListIterable<Person> peopleParallel = people.asParallel(threadPool, batchSize);
    

    min(), max(), minBy(), and maxBy() on ParallelIterable.

    Similar to the same methods on RichIterable. These methods force evaluation.

    ParallelListIterable<Person> peopleParallel = people.asParallel(threadPool, batchSize);
    Integer youngestAge = peopleParallel.collect(Person::getAge).min();
    Integer oldestAge = peopleParallel.collect(Person::getAge).max();
    Person youngestPerson = peopleParallel.minBy(Person::getAge);
    Person oldestPerson = peopleParallel.maxBy(Person::getAge);
    

    sumOfInt(), sumOfFloat(), sumOfLong(), sumOfDouble() on ParallelIterable.

    Similar to the same methods on RichIterable. These methods force evaluation.

    ParallelListIterable<Person> peopleParallel = people.asParallel(threadPool, batchSize);
    long sum1 = peopleParallel.sumOfInt(Person::getIntAttribute);
    long sum2 = peopleParallel.sumOfLong(Person::getLongAttribute);
    double sum3 = peopleParallel.sumOfFloat(Person::getFloatAttribute);
    double sum4 = peopleParallel.sumOfDouble(Person::getDoubleAttribute);
    

    Multimap API

    Constructors for Multimaps that take Iterable<Pair<K, V>>.

    ListIterable<Pair<Integer, String>> pairs = ...;
    Multimap<Integer, String> actual = FastListMultimap.newMultimap(pairs);
    

    MutableMultimap.add(Pair).

    Similar to MutableMultimap.put(K, V) but takes Pair<K, V> instead.

    Multimap.forEachKeyMultiValues(Procedure2<K, ? super Iterable>)

    Similar to forEachKeyValue(Procedure2<K, V>) but the Procedure2 gets invoked on each group of values instead of each individual value.

    Multimap.selectKeysValues(Predicate2<? super K, ? super V>) and Multimap.rejectKeysValues(Predicate2<? super K, ? super V>).

    Similar to RichIterable.select() and RichIterable.reject() but the Predicate2 is evaluated against each key/value pair. The implementation of the Predicate2 is free to ignore either the key or the value.

    Multimap.selectKeysMultiValues(Predicate2<? super K, ? super Iterable>) and Multimap.rejectKeysMultiValues(Predicate2<? super K, ? super Iterable>).

    Similar to Multimap.selectKeysValues() and Multimap.rejectKeysValues() but the Predicate2 takes (K, Iterable) pairs instead of (K, V) pairs.

    Multimap.collectKeysValues(Function2<? super K, ? super V, Pair<K2, V2>>).

    Similar to RichIterable.collect() but the Function2 is applied to each key/value pair.

    Multimap.collectValues(Function<? super V, ? extends V2>)

    Similar to Multimap.collectKeysValues() but only transforms keys. It is more efficient than using Multimap.collectKeysValues() and passing through the keys unchanged.

    Multimap<K, V>.flip(): Multimap<V, K>.

    Returns a new Multimap where the positions of the keys and values are swapped.

    Other new API

    Unify the map interface hierarchy through new interfaces MutableMapIterable and ImmutableMapIterable.

    MutableMap, MutableSortedMap, and MutableBiMap now extend a common interface MutableMapIterable. ImmutableMap, ImmutableSortedMap, and ImmutableBiMap now extend a common interface ImmutableMapIterable. The SetIterable and Bag hierarchy had similar changes.

    MutableIterator.remove()

    Mutable<Primitive>Iterator is a new subclass of <Primitive>Iterator that adds the remove() method. It behaves similarly to Iterator.remove(), but does not appear on immutable primitive containers and thus doesn't throw UnsupportedOperationException. Immutable containers continue to return the read-only <Primitive>Iterator.

    Bag.topOccurrences() and Bag.bottomOccurrences().

    Bag.topOccurrences() returns the most frequently occurring item. Bag.bottomOccurrences() returns the least frequently occurring item. In the event of a tie, all tied items are returned.

    ImmutableList.subList(fromIndex, toIndex): ImmutableList.

    Similar to List.subList() but returns an ImmutableList.

    Primitive forms of MutableList.sortThisBy().

    Similar to sortThisBy(Function) but taking primitive functions. For example,

    MutableList<T> sortThisByInt(IntFunction<? super T> function);
    MutableList<T> sortThisByFloat(FloatFunction<? super T> function);
    ...
    

    Pair.swap().

    Returns a new Pair with the two elements transposed.

    Functions.swappedPair().

    Returns a Function which swaps the two elements in a Pair. Similar to Pair::swap but doesn't rely on Java 8.

    StringIterate.chunk(int).

    Breaks up a String into fixed size chunks. Similar to RichIterable.chunk(), but for Strings rather than collections.

    New Containers

    ImmutableBiMap

    ImmutableBiMaps can be created by using the BiMaps factory or by calling MutableBiMap.toImmutable().

    MutableBiMap<Integer, Character> biMap = ...;
    ImmutableBiMap<Integer, Character> characters = biMap.toImmutable();
    

    MultiReaderFastListMultimap, MultiReaderUnifiedSetMultimap, and MultiReaderHashBagMultimap.

    Thread-safe Multimaps backed by ConcurrentMutableMaps of multi-reader collections.

    Tests

    JUnit Runner for interfaces containing concrete tests. New test suite leveraging virtual extension methods.

    A new JUnit Runner named Java8Runner that extends the standard test runner by looking for tests in interfaces in addition to classes. Tests in interfaces are default methods annotated with @Test. For example:

    @Test
    default void MutableList_sortThis()
    {
        MutableList<Integer> mutableList = this.newWith(5, 1, 4, 2, 3);
        MutableList<Integer> sortedList = mutableList.sortThis();
        assertSame(mutableList, sortedList);
        assertEquals(Lists.immutable.with(1, 2, 3, 4, 5), sortedList);
    }
    

    This allows for a form of multiple inheritance in tests. For example, a MutableList is both a MutableCollection and a ListIterable. Any assertions about MutableCollections and ListIterables should be true for MutableLists as well. Thus, the test interface MutableListTestCase extends both MutableCollectionTestCase and ListIterableTestCase.

    unit-tests-java8 is a new test suite containing over 50 new test classes and 60 new test interfaces.

    Additional JMH Tests

    Performance tests covering min, max, minBy, maxBy, sumOf, and sumBy.

    Optimizations

    Optimize primitive hash maps with keys and values of the same primitive type.

    Primitive hash maps with keys and values of the same primitive type (IntIntHashMap, DoubleDoubleHashMap, etc.), keys and values are now stored in a single array of double the length.

    This yields a small memory savings and a speed increase in larger maps. The corresponding JMH performance tests are IntIntMapTest and LongIntMapTest.

    Optimize code paths that unnecessarily use iterator by delegating to IterableIterate by delegating to forEach() instead.

    Bug Fixes

    • Make ArrayListAdapterSerializationTest more robust for future versions of Java. Fixes #12.
    • Fix array index bug in ArrayList.sortThis(). Fixes #16.
    • Fix ObjectHashMap.injectInto() to include sentinels values.
    • Fix ImmutableSortedMap.entrySet() to return entries sorted by key.
    • Fix CountSetTest to delegate to CountSetScalaTest. Fixes #15.
    • Fix concurrency issue in the aggregateBy tests.
    • Fix the iteration order of several iteration patterns.
    • Use the Kahan summation algorithm to handle double and float precision in sumOf().
    • Fix looping logic in SortedSetIterable.forEach() and SortedSetIterable.forEachWithIndex() with fromIndex and toIndex.
    • Fix CompositeFastList.size() to execute in constant time.
    • Fix ListAdapter.reverseThis() to run in linear time.
    • Fix ListIterate.toArray(list, target, startIndex, sourceSize) and ListIterate.getLast() to run in linear time.
    • Fix UnifiedSet.getLast() and UnifiedSetWithHashingStrategy.getLast() to return the last instead of the first element.
    Source code(tar.gz)
    Source code(zip)
  • 5.1.0(Jun 2, 2014)

    Binaries

    gs-collections-5.1.0.zip

    Javadoc

    5.1.0 Javadoc

    JDiff

    Differences between 5.0.0 and 5.1.0

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="5.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="5.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="5.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="5.1.0"/>
    

    Improvements

    Java Microbenchmark Harness performance test suite

    There are two new modules named jmh-scala-tests and jmh-tests which include new performance tests leveraging Java Microbenchmark Harness. They supplement the existing performance-tests module. The focus of these tests is to compare the performance of various iteration patterns across several libraries, including GS Collections, Java 8 Streams, Scala collections, and Guava. Each iteration pattern is tested in serial and in parallel. Where the API is available, they are also tested eagerly and lazily.

    As an example, here is the test of the GS Collections implementation of count(), using serial eager evaluation.

    @GenerateMicroBenchmark
    public void serial_eager_gsc()
    {
        int evens = this.integersGSC.count(each -> each % 2 == 0);
        Assert.assertEquals(SIZE / 2, evens);
    }
    

    Use of lambdas in the test suites

    The GS Collections library is compiled with Java 5 to ensure its backwards compatibility. However, the test modules are free to use any version of Java. Most of the test modules now use Java 8. We've replaced all of the anonymous inner classes with lambdas or method references. We've also replaced many usages of code block factories with the equivalent lambda or method reference. For example, instead of using Functions.getToString(), we use String::valueOf in most tests.

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Mar 21, 2014)

    Binaries

    gs-collections-5.0.0.zip

    Javadoc

    5.0.0 Javadoc

    JDiff

    API differences between 4.0.0 and 5.0.0

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="5.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="5.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="5.0.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="5.0.0"/>
    

    New Functionality

    Parallel-Lazy Iteration

    Previous versions of GS Collections included parallel evaluation and lazy evaluation as separate features. Parallel-eager utility has been available through the ParallelIterate utility class. Serial-lazy evaluation has been available through LazyIterable, the view returned by RichIterable.asLazy(). GS Collections 5.0 adds parallel-lazy evaluation through ParallelIterable, the view returned by asParallel(ExecutorService, int batchSize). The method asParallel is not on interfaces like RichIterable yet, but rather on a few supported collections, including FastList and UnifiedSet.

    FastList<Integer> integers = FastList.newListWith(1, 2, 3, 4, 5, 6, 7, 8, 9);
    
    ExecutorService threadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
    int batchSize = 2;
    ParallelListIterable<Integer> parallelListIterable = integers.asParallel(threadPool, batchSize);
    ParallelListIterable<Integer> evenNumbers = parallelListIterable.select(each -> each % 2 == 0); // deferred evaluation
    ParallelListIterable<String> evenStrings = evenNumbers.collect(Object::toString); // deferred evaluation
    MutableList<String> strings = evenStrings.toList(); // forced evaluation
    threadPool.shutdown();
    Assert.assertEquals(FastList.newListWith("2", "4", "6", "8"), strings);
    

    The calls to select and collect are lazy, indicated by the fact that they return subclasses of ParallelIterable. The call to toList() forces evaluation.

    The two parameters to asParallel are used to configure parallelism. The code example above sets up a thread pool with one thread per core, which is appropriate for CPU bound tasks. It's possible to configure the thread pool for IO bound tasks, and to share thread pools between multiple calls to asParallel. The batch size determines the number of elements from the backing collection that get processed by each task submitted to the thread pool. The appropriate batch size for CPU-bound tasks will be much larger, usually 10,000 to 100,000. The right batch size should be determined through thorough performance testing.

    NOTE: The new parallel-lazy API is experimental and is tagged as @Beta. Until we remove the @Beta annotation, we reserve the right to make incompatible changes to the parallel-lazy API even in minor versions of GS Collections.

    API

    anySatisfyWith, allSatisfyWith, noneSatisfyWith, countWith, partitionWith, detectWith, and detectWithIfNone on RichIterable

    These are the two-argument forms of anySatisfy, allSatisfy, noneSatisfy, count, partition, detect and detectIfNone. They take a Predicate2 instead of a Predicate, and a second argument, which is passed as the second argument to the Predicate2. The two argument forms allow reusing some code blocks that would otherwise have one differing parameter, resulting in less garbage creation. Some of these methods already existed on MutableCollection and were pulled up to RichIterable. Here is a comparison between anySatisfy and anySatisfyWith.

    Assert.assertTrue(this.newWith(1, 2, 3).anySatisfyWith(Predicates2.equal(), 2));
    Assert.assertTrue(this.newWith(1, 2, 3).anySatisfy(Predicates.equal(2)));
    

    RichIterable.collect<Primitive>(<Primitive>Function, Mutable<Primitive>Collection target)

    The new overload RichIterable.collect<Primitive>(<Primitive>Function, Mutable<Primitive>Collection target) is similar to collect<Primitive>(<Primitive>Function), except that the results are gathered into the specified target collection.

    ListIterable.toImmutable(), SortedSetIterable.toImmutable(), UnsortedSetIterable.toImmutable(), SortedMapIterable.toImmutable(), UnsortedMapIterable.toImmutable(), StackIterable.toImmutable()

    Previously, toImmutable() only existed on MutableCollections. It's now available on the read-only interfaces as well. When called on an immutable collection, it returns the same instance.

    MutableStack<Integer> mutableStack = Stacks.mutable.with(1, 2, 3);
    Verify.assertInstanceOf(ImmutableStack.class, mutableStack.toImmutable());
    Assert.assertNotSame(mutableStack, mutableStack.toImmutable());
    
    StackIterable<Integer> immutableStack = Stacks.immutable.with(1, 2, 3);
    Assert.assertSame(immutableStack, immutableStack.toImmutable());
    

    ListIterable.binarySearch(T) and ListIterable.binarySearch(T, Comparator)

    Similar to java.util.Collections.binarySearch, but available from the object-oriented API.

    LazyIterable.distinct() and LazyIterate.distinct(Iterable)

    Similar to toSet(), but returns a LazyIterable (does not force evaluation).

    MapIterable.flip()

    Returns a new associative array where the position of the keys and values have been flipped. Since the values in the MapIterable are not necessarily unique, flip() returns a Multimap instead of a MapIterable. Since the keys in the MapIterable are unique, flip() returns a SetMultimap instead of the more general Multimap interface. In summary, MapIterable<K, V>.flip() returns SetMultimap<V, K>.

    MutableSetMultimap<String, String> expected = UnifiedSetMultimap.newMultimap();
    expected.put("odd", "One");
    expected.put("even", "Two");
    expected.put("odd", "Three");
    expected.put("even", "Four");
    
    Assert.assertEquals(expected, UnifiedMap.newWithKeysValues("One", "odd", "Two", "even", "Three", "odd", "Four", "even").flip());
    

    MapIterable.flipUniqueValues()

    Similar to MapIterable.flip() but asserts that the values in the MapIterable are unique and thus returns MapIterable instead of Multimap. Throws IllegalArgumentException if the MapIterable contains duplicate values.

    MapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
    MapIterable<String, Integer> flip = map.flipUniqueValues();
    Assert.assertEquals(UnifiedMap.newWithKeysValues("1", 1, "2", 2, "3", 3), flip);
    

    MutableMap.getIfAbsentPut(K key, V value)

    Gets and returns the value in the map at the specified key. If the map does not contain the key, getIfAbsentPut() puts the value in the map and returns it. Similar to getIfAbsentPut(K key, Function0<? extends V> function), but takes in a value directly instead of a value factory (Function0).

    MutableMap<Integer, String> map = UnifiedMap.newWithKeysValues(1, "1", 2, "2", 3, "3");
    
    Assert.assertEquals("4", map.getIfAbsentPut(4, "4")); // mutates
    Assert.assertEquals("3", map.getIfAbsentPut(3, "5")); // does not mutate
    Verify.assertContainsKeyValue(3, "3", map);
    Verify.assertContainsKeyValue(4, "4", map);
    

    MutableMap.add(Pair<K, V>)

    Adds the key-value pair to the map. It's a convenience method for working with Pairs, similar to put(K, V).

    MutableMap<String, Integer> map = this.newMapWithKeyValue("A", 1);
    Assert.assertEquals(Integer.valueOf(1), map.add(Tuples.pair("A", 3)));
    
    Assert.assertNull(map.add(Tuples.pair("B", 2)));
    Verify.assertMapsEqual(UnifiedMap.newWithKeysValues("A", 3, "B", 2), map);
    

    MutableBag.setOccurrences(T item, int occurrences)

    Mutates the bag to contain the given number of occurrences of the item. Returns true if the bag has been modified as a result of the call to setOccurrences().

    MutableBag<String> bag = HashBag.newBag();
    MutableBag<String> expected = this.newWith("betamax-tape", "betamax-tape");
    
    Assert.assertTrue(bag.setOccurrences("betamax-tape", 2));
    Assert.assertEquals(expected, bag);
    

    ListIterate.reverseForEachWithIndex(List, ObjectIntProcedure)

    Iterates over the list in reverse order executing the ObjectIntProcedure for each element. The index passed into the ObjectIntProcedure is the actual index of the range.

    Primitive API

    Mutable<Primitive>Collection.retainAll

    Like Collection.retainAll, but for primitive collections. There are two variants, one that takes a <Primitive>Iterable, and another that takes varargs.

    Assert.assertTrue(collection.retainAll(IntArrayList.newListWith(1, 2, 5)));
    Assert.assertEquals(this.newMutableCollectionWith(1, 2), collection);
    MutableIntCollection collection = this.newMutableCollectionWith(1, 2, 3);
    Assert.assertFalse(collection.retainAll(1, 2, 3));
    Assert.assertEquals(this.newMutableCollectionWith(1, 2, 3), collection);
    

    keysView() and keyValuesView() on primitive maps

    Returns a lazy view of keys or key/value pairs respectively.

    keySet() and values() on synchronized, unmodifiable, and immutable primitive maps

    These methods already existed on the API but threw UnsupportedOperationExceptions in places. They are fully supported now.

    addToValue(key, amount) on mutable primitive maps

    Adds the given amount to the value at the given key and returns the updated value. This method exists only for maps where the values are numeric types (not boolean or Object).

    MutableByteIntMap map = new ByteIntHashMap();
    Assert.assertEquals(1, map.addToValue((byte) 0, 1));
    Assert.assertEquals(ByteIntHashMap.newWithKeysValues((byte) 0, 1), map);
    
    Assert.assertEquals(11, map.addToValue((byte) 0, 10));
    Assert.assertEquals(ByteIntHashMap.newWithKeysValues((byte) 0, 11), map);
    

    Mutable<Primitive>ObjectMap.putAll(<Primitive>ObjectMap)

    putAll() was already implemented on MutableObject<Primitive>Map and <Primitive><Primitive>Map. This rounds out the API.

    Reversible<Primitive>Iterable.asReversed()

    Returns a reversed view of the primitive iterable. Like ReversibleIterable.asReversed(), but for the primitive API.

    Reversible<Primitive>Iterable.toReversed()

    Returns a reversed copy of the primitive iterable. Like asReversed() but executes eagerly.

    <Primitive>Iterable.injectInto

    injectInto was already implemented on primitive collections and has now been pulled up to the <Primitive>Iterable interfaces.

    IntIterable arrayList = IntArrayList.newListWith(1, 2, 3);
    MutableInteger sum = arrayList.injectInto(new MutableInteger(0), new ObjectIntToObjectFunction<MutableInteger, MutableInteger>()
    {
        public MutableInteger valueOf(MutableInteger object, int value)
        {
            return object.add(value);
        }
    });
    Assert.assertEquals(new MutableInteger(6), sum);
    

    Code Block Factory Methods

    Functions.nullSafe(Function)

    Returns a null-safe wrapper around the given Function. The wrapper delegates to the valueOf() method of the delegate Function only if the parameter is not null, otherwise it returns null or the provided null replacement value.

    MutableList<Integer> squares = FastList.newListWith(1, 2, null, 3).collect(Functions.nullSafe(Functions.squaredInteger()));
    Assert.assertEquals(FastList.newListWith(1, 4, null, 9), squares);
    
    MutableList<Integer> squaresWithNullValue =
      FastList.newListWith(1, 2, null, 3).collect(Functions.nullSafe(Functions.squaredInteger(), 0));
    Assert.assertEquals(FastList.newListWith(1, 4, 0, 9), squaresWithNullValue);
    

    Functions2.integerAddition()

    Creates a Function2 that takes in two Integers as parameters and returns their sum.

    HashingStrategies.chain(HashingStrategy...)

    Takes a vararg number of hashing strategies and returns a wrapper HashingStrategy that considers objects as equal if all the delegate strategies consider them equal. The hashcode is computed using a strategy similar to code-generated hashCode() methods. It start with the first delegate strategy's computed hashcode, and then repeatedly multiplies the accumulated hashcode by 31 and adds the next computed hashcode for each remaining delegate strategy.

    HashingStrategies.identityStrategy()

    Returns a HashingStrategy that considers objects as equal only if they are the same object. It uses reference equality in the implementation of equals, and System.identityHashCode in the implementation of computeHashCode.

    HashingStrategies.fromFunctions(Function, Function) and HashingStrategies.fromFunctions(Function, Function, Function)

    Creates a HashingStrategy from each Function, chains them, and returns the chain.

    HashingStrategies.from<Primitive>Function

    Similar to HashingStrategies.fromFunction(Function) but optimized for primitives. Implemented in a way that calls to equals and computeHashCode do not create any garbage.

    ReversibleIterable and SortedIterable Interfaces

    Two new interfaces have been introduced in the GS Collections Hierarchy. ReversibleIterable is an ordered iterable which can be traversed efficiently forwards or backwards. ReversibleIterable has extra API for iterating from the end like asReversed() and reverseForEach(). Lists are the most common ReversibleIterables, and ListIterable extends ReversibleIterable.

    ReversibleIterable Inheritance Hierarchy

    SortedIterable, is an ordered iterable where the elements are stored in sorted order. Its method comparator() returns the Comparator used to sort the elements, or null if they are sorted in natural order. SortedSetIterable and SortedBag extend SortedIterable.

    Changes in the Bag Interface Hierarchy

    The inheritance hierarchy of Bags is now more consistent with Sets. We introduced a new interface UnsortedBag, as a sibling of SortedBag. Bag no longer overrides collect, so it returns RichIterable instead of Bag. SortedBag.collect returns ListIterable instead of Bag. UnsortedBag.collect returns UnsortedBag, which means the implementations of UnsortedBag.collect are unchanged. The new interface structure is as follows:

    Bag Inheritance Hierarchy

    The change to the interface hierarchy changed the serialized forms of TreeBag and UnmodifiableSortedBag.

    Changes to serialized forms

    Serialized form of synchronized and unmodifiable collections

    The hierarchy of synchronized and unmodifiable collections has been changed slightly. AbstractSynchronizedMutableCollection has been extracted from SynchronizedMutableCollection, and all the classes that used to extend SynchronizedMutableCollection like SynchronizedMutableList and SynchronizedMutableSet now extend AbstractSynchronizedMutableCollection directly. Similar changes have been made to the unmodifiable collections.

    Serialized form of immutable collections

    The serialized forms of ImmutableSet, ImmutableBag and ImmutableMap implementations have been changed.

    The ImmutableSet implementations now use a proxy class for serialization.

    The implementations of ImmutableMap and ImmutableBag already used proxy classes for serialization. These proxy classes were inner classes inside AbstractImmutableMap and AbstractImmutableBag respectively. These proxy classes were moved to top level, package private classes.

    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Oct 28, 2013)

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="4.2.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="4.2.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="4.2.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="4.2.0"/>
    

    New Functionality

    SortedBag

    SortedBag has all of the same properties as a Bag, and additionally maintains order by a Comparator or by the elements' natural order.

    The main implementation is TreeBag which delegates to a TreeSortedMap to store its data.

    MutableSortedBag<Integer> emptySortedBag = TreeBag.newBag();
    MutableSortedBag<Integer> emptySortedBagWithComparator =
      TreeBag.newBag(Collections.reverseOrder());
    MutableSortedBag<Integer> naturalOrder =
      TreeBag.newBagWith(1, 2, 3);
    MutableSortedBag<Integer> reversedOrder =
      TreeBag.newBagWith(Collections.reverseOrder(), 4, 3, 3, 2, 2, 1);
    MutableSortedBag<Integer> sortedBagFromFastList =
      TreeBag.newBag(FastList.newListWith(1, 2, 3));
    MutableSortedBag<Integer> sortedBagFromFastListWithComparator =
    
    TreeBag.newBag(Collections.reverseOrder(), FastList.newListWith(1, 2, 3));
    

    BiMap

    BiMap is a map that allows users to perform lookups from both directions. Both the keys and the values in a BiMap are unique.

    The main implementation is HashBiMap.

    inverse()

    BiMap.inverse() returns a view where the position of the key type and value type are swapped.

    MutableBiMap<Integer, String> biMap =
      HashBiMap.newWithKeysValues(1, "1", 2, "2", 3, "3");
    MutableBiMap<String, Integer> inverse = biMap.inverse();
    Assert.assertEquals("1", biMap.get(1));
    Assert.assertEquals(Integer.valueOf(1), inverse.get("1"));
    Assert.assertTrue(inverse.containsKey("3"));
    Assert.assertEquals(Integer.valueOf(2), inverse.put("2", 4));
    

    put()

    MutableBiMap.put() behaves like Map.put() on a regular map, except it throws when a duplicate value is added.

    MutableBiMap<Integer, String> biMap = HashBiMap.newMap();
    biMap.put(1, "1"); // behaves like a regular put()
    biMap.put(1, "1"); // no effect
    biMap.put(2, "1"); // throws IllegalArgumentException
    

    forcePut()

    This behaves like MutableBiMap.put(), but it silently removes the map entry with the same value before putting the key-value pair in the map.

    MutableBiMap<Integer, String> biMap = HashBiMap.newMap();
    biMap.forcePut(1, "1"); // behaves like a regular put()
    biMap.forcePut(1, "1"); // no effect
    biMap.put(1, "2"); // replaces the [1,"1"] pair with [1, "2"]
    biMap.forcePut(2, "2"); // removes the [1, "2"] pair before putting
    Assert.assertFalse(biMap.containsKey(1));
    Assert.assertEquals(HashBiMap.newWithKeysValues(2, "2"), biMap);
    

    Optimize HashBag by delegating to ObjectIntHashMap

    HashBag now delegates to ObjectIntHashMap<K> instead of a MutableMap<K, Counter>. This saves memory by eliminating the Counter wrapper objects.

    Functions.chain()

    The Functions.chain<primitive>() methods are similar to Functions.chain(), but they take a primitive function as the second argument. There are variants for all eight primitives:

    • chainBoolean()
    • chainByte()
    • chainChar()
    • chainDouble()
    • chainInt()
    • chainFloat()
    • chainLong()
    • chainShort()
    Source code(tar.gz)
    Source code(zip)
  • 4.1.0(Sep 27, 2013)

    Acquiring GS Collections

    Maven

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

    Ivy

    <dependency org="com.goldmansachs" name="gs-collections-api" rev="4.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections" rev="4.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections-testutils" rev="4.1.0" />
    <dependency org="com.goldmansachs" name="gs-collections-forkjoin" rev="4.1.0"/>
    

    New Functionality

    Version 4.1 has been released to support deployment to Maven Central. Most of the changes are build related. There is only one piece of new functionality.

    Comparators.byFunction

    The Comparators.by<primitive>Function() methods are just like Comparators.byFunction(), but specialized for primitive types. They allow you to sort or compare elements by some primitive attribute without doing any autoboxing.

    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Sep 11, 2013)

    Binaries

    gs-collections-4.0.0.zip

    Javadoc

    4.0.0 Javadoc

    JDiff

    API differences between 3.0.0 and 4.0.0

    New Functionality

    Version 4.0 completes the immutable primitive collections work started in 3.2.0. All the primitive collections now have immutable counterparts.

    Immutable Primitive Collections

    4.0 has immutable primitive sets, stacks, bags and maps. They can each be created using either the toImmutable() method or the primitive collection factories.

    MutableIntSet set = IntHashSet.newSetWith(1, 2, 3);
    ImmutableIntSet immutableSet = set.toImmutable();
    
    ImmutableIntSet immutableSet2 = IntSets.immutable.of(1, 2, 3);
    
    MutableIntStack stack = IntArrayStack.newStackWith(1, 2, 3);
    ImmutableIntStack immutableStack = stack.toImmutable();
    
    ImmutableIntStack immutableStack2 = IntStacks.immutable.of(1, 2, 3);
    
    MutableIntBag bag = IntHashBag.newBagWith(1, 2, 3);
    ImmutableIntBag immutableBag = bag.toImmutable();
    
    ImmutableIntBag immutableBag2 = IntBags.immutable.of(1, 2, 3);
    
    MutableIntCharMap map = IntCharHashMap.newWithKeysValues(1, 'a', 2, 'b', 3, 'c');
    ImmutableIntCharMap immutableMap = map.toImmutable();
    
    ImmutableIntCharMap immutableMap2 = IntCharMaps.immutable.ofAll(map);
    

    collect() Methods on RichIterable

    The collect() methods on RichIterable are similar to collect(), but they take a primitive function and return a primitive collection. There are variants for all eight primitives.

    • collectBoolean()
    • collectByte()
    • collectChar()
    • collectShort()
    • collectInt()
    • collectFloat()
    • collectLong()
    • collectDouble()

    More API on Primitive Maps

    Primitive maps now include additional API from the non-primitive variants.

    putAll()

    Copies all of the mappings from the map parameter to this map.

    keySet()

    Returns a set view of the keys contained in the map. Changes to the map are reflected in the set, and vice versa. The set supports removal, which removes the corresponding mapping from the map. It does not support add() or addAll().

    values()

    Returns a collection view of the values contained in the map. Changes to the map are reflected in the collection, and vice versa. The collection supports removal, which removes the corresponding mapping from the map. It does not support add() or addAll().

    Source code(tar.gz)
    Source code(zip)
    gs-collections-api-4.0.0-sources.jar(810.78 KB)
    gs-collections-4.0.0.jar(7.11 MB)
    gs-collections-4.0.0-sources.jar(2.99 MB)
    gs-collections-api-4.0.0.jar(479.17 KB)
    gs-collections-testutils-4.0.0-sources.jar(13.16 KB)
    gs-collections-forkjoin-4.0.0-sources.jar(14.63 KB)
    gs-collections-testutils-4.0.0.jar(21.19 KB)
    gs-collections-forkjoin-4.0.0.jar(25.08 KB)
  • 3.2.0(Sep 11, 2013)

    Binaries

    gs-collections-3.2.0.zip

    Javadoc

    3.2.0 Javadoc

    New Functionality

    Immutable Primitive Containers

    Version 3.2 adds initial support for immutable primitive containers, starting with lists. They can be created using the toImmutable() method or using the primitive list factories.

    MutableIntList mutableIntList = IntArrayList.newListWith(1, 2, 3);
    ImmutableIntList immutableIntList = mutableIntList.toImmutable();
    
    ImmutableIntList immutableIntList = IntLists.immutable.of(1, 2, 3);
    

    injectInto() on primitive collections

    Primitive containers now support injectInto(). It works like RichIterable.injectInto(), but it takes an Object<Primitive>ToObjectFunction, where the primitive type matches the container type. The accumulator can be any type.

    IntArrayList arrayList = IntArrayList.newListWith(1, 2, 3);
    MutableInteger sum = arrayList.injectInto(new MutableInteger(0), new ObjectIntToObjectFunction<MutableInteger, MutableInteger>()
        {
            public MutableInteger valueOf(MutableInteger object, int value)
            {
                return object.add(value);
            }
        });
    Assert.assertEquals(new MutableInteger(6), sum);
    

    injectIntoWithIndex() on primitive lists

    injectIntoWithIndex() is similar to injectInto(), except the function takes a third parameter: the index of the current element. It's only available on lists since sets and bags don't have indexed positions.

    IntArrayList list1 = IntArrayList.newListWith(1, 2, 3);
    final IntArrayList list2 = IntArrayList.newListWith(1, 2, 3);
    MutableInteger dotProduct = list1.injectIntoWithIndex(new MutableInteger(0), new ObjectIntIntToObjectFunction<MutableInteger, MutableInteger>()
        {
            public MutableInteger valueOf(MutableInteger object, int value, int index)
            {
                return object.add(value * list2.get(index));
            }
        });
    Assert.assertEquals(new MutableInteger(14), dotProduct);
    

    dotProduct() on primitive lists

    The primitive lists that hold numeric types now support dotProduct(). It takes a second list, multiplies the pairs of elements appearing at the same index, and sums the products.

    @Test
    public void dotProduct()
    {
       IntArrayList list1 = IntArrayList.newListWith(1, 2);
       IntArrayList list2 = IntArrayList.newListWith(3, 4);
       Assert.assertEquals(1 * 3 + 2 * 4, list1.dotProduct(list2));
    }
    

    forEachWithIndex() on primitive lists

    Evaluates the <Primitive>IntProcedure for each element in the list passing in the element and its index.

    final StringBuilder string = new StringBuilder();
    CharArrayList.newListWith('a', 'b', 'c').forEachWithIndex(new CharIntProcedure()
        {
            public void value(char each, int index)
            {
                string.append(each).append('-').append(index);
            }
        });
    Assert.assertEquals("a-1b-2c-3", string.toString());
    

    Unmodifiable wrappers for primitive maps

    Version 3.2 adds unmodifiable wrappers for primitive-to-Object maps and Object-to-primitive maps. With this addition, all primitive collections support asUnmodifiable().

    @Test(expected = UnsupportedOperationException.class)
    public void put_throws()
    {
       MutableIntObjectMap<String> map = IntObjectHashMap.newWithKeysValues(0, "zero", 31, "thirtyOne", 32, "thirtyTwo");
       MutableIntObjectMap<String> unmodifiableMap = map.asUnmodifiable();
       unmodifiableMap.put(0, "one");
    }
    

    No API changes in this release

    This release preserves binary, source, and serialization compatibility with 3.0.

    • The method toImmutable() already existed on primitive collections in GS Collections 3.0, but it threw UnsupportedOperationException.
    • injectInto(), injectIntoWithIndex() and forEachWithIndex() only have been added to the implementations. They will be added to the primitive iterable interfaces in the next major release.
    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Sep 11, 2013)

    Binaries

    gs-collections-3.1.0.zip

    Javadoc

    3.1.0 Javadoc

    New Functionality

    Synchronized and Unmodifiable Wrappers for Primitive Collections

    The wrappers for primitive collections are similar to the wrappers for generic collections.

    asUnmodifiable() returns a wrapper which throws on mutating methods. All other methods pass through to the wrapped collection.

    For example:

    @Test(expected = UnsupportedOperationException.class)
    public void add_throws()
    {
        IntArrayList list = IntArrayList.newListWith(1, 2, 3);
        MutableIntList unmodifiableList = list.asUnmodifiable();
        unmodifiableList.add(4);
    }
    

    asSynchronized() returns a wrapper which synchronizes on a lock before delegating to the wrapped collection. The iterator is still not synchronized, so the warning on [java.util.Collections.synchronizedCollection()](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedCollection(java.util.Collection)) applies to this API as well.

    By default, the lock is the wrapper itself. Use the wrapper's constructor instead of the asSynchronized() method if you need to customize the lock.

    Fork Join Functionality

    This release includes a new module, gs-collections-forkjoin-3.1.0.jar. Its main utility is the FJIterate class. It's conceptually similar to ParallelIterate, but it's based on Java 7's ForkJoinPools. All other modules continue to be backward compatible with Java 5.

    Improved memory benchmarks and performance tests

    This release includes additional performance test for UnifiedSet and ImmutableArrayList. Existing performance tests are now more fair. The memory tests record more data points.

    No API changes in this release

    The methods asUnmodifiable() and asSynchronized() already existed on primitive collections in GS Collections 3.0, but they threw UnsupportedOperationException. There are no API changes in this release. It preserves binary, source, and serialization compatibility with 3.0.

    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Sep 11, 2013)

    Binaries

    gs-collections-3.0.1.zip

    Javadoc

    3.0.0 Javadoc

    JDiff

    API differences between 2.0.0 and 3.0.0

    New Functionality

    Primitive Collections

    GS Collections 3.0 has memory optimized collections for primitive types. The collections include lists, sets, stacks, maps and bags. The interface hierarchy is very similar to the hierarchy of object collections.

    Some examples:

    InterfaceAnalogous to
    IntIterableRichIterable
    MutableIntCollection MutableCollection
    IntList ListIterable
    MutableIntListMutableList

    The hierarchy is similar for the other primitive types.

    Primitive Lists

    Primitive lists are backed by an array (like FastList), but it's a primitive array instead of Object[]. They are named IntArrayList, FloatArrayList, etc.

    BooleanArrayList is a special case. Current JVMs use one byte per boolean in a boolean[], instead of one bit per boolean. BooleanArrayLists are backed by a java.util.BitSet as an optimization.

    To create an IntArrayList, use one of the following:

    IntArrayList emptyList = new IntArrayList();
    IntArrayList intList = IntArrayList.newListWith(1, 2, 3);
    IntArrayList listFromIntIterable = IntArrayList.newListWith(IntHashSet.newSetWith(1, 2, 3));
    
    IntInterval

    IntInterval is Similar to Interval, but implements the IntList interface instead of List. It represents a range of ints and a step value.

    Assert.assertEquals(IntArrayList.newListWith(1, 2, 3), IntInterval.oneTo(3));
    Assert.assertEquals(IntArrayList.newListWith(1, 3, 5), IntInterval.oneToBy(5, 2));
    

    Primitive Sets

    The primitive set implementations are backed by hashtables. The hashtables are implemented using open addressing and quadratic probing. They are named IntHashSet, FloatHashSet, etc. BooleanHashSet is implemented using a single integer to keep track of the four states [], [F], [T], or [T, F].

    Primitive Stacks

    Primitive stacks are similar to ArrayStack but backed by primitive lists instead of FastList.

    Primitive Bags

    Primitive bags are similar to HashBag, but both item and count are primitives.

    Primitive Maps

    There are three types of primitive maps:

    1. Object to Primitive (ObjectIntHashMap, ObjectFloatHashMap, etc.)
    2. Primitive to Object (IntObjectHashMap, FloatObjectHashMap, etc.)
    3. Primitive to Primitive (IntIntHashMap, IntLongHashMap, etc.)

    There are no maps with boolean keys. All the maps are implemented as hashtables using open addressing and quadratic probing.

    get()

    Since there is no concept of null when working with primitives, maps with primitive values return an EMPTY_VALUE sentinel from get() if the key is not present in the map. EMPTY_VALUE is false for boolean and 0 for all other primitives.

    IntIntHashMap map = IntIntHashMap.newWithKeysValues(1, 1, 2, 2, 3, 3);
    Assert.assertEquals(1, map.get(1));
    Assert.assertEquals(2, map.get(2));
    Assert.assertEquals(3, map.get(3));
    Assert.assertEquals(0, this.map.get(4));
    
    Assert.assertFalse(new IntBooleanHashMap().get(1));
    
    getOrThrow()

    If the key is present in the map, getOrThrow() returns the corresponding value, otherwise it throws IllegalStateException.

    final IntIntHashMap map = IntIntHashMap.newWithKeysValues(1, 1, 2, 2, 3, 3);
    Assert.assertEquals(1, map.getOrThrow(1));
    Assert.assertEquals(2, map.getOrThrow(2));
    Assert.assertEquals(3, map.getOrThrow(3));
    
    Verify.assertThrows(IllegalStateException.class, new Runnable()
    {
        public void run()
        {
            map.getOrThrow(4);
        }
    });
    

    Primitive Code Blocks and Code Block Factories

    IntPredicates, LongPredicates, etc. can be used to create common instances of IntPredicate, LongPredicate, etc.

    More API

    RichIterable.aggregateBy()

    Groups the elements in the RichIterable by the function named groupBy. Then all the values that map to the same key are aggregated together using the Function2 named aggregator. aggregateBy is conceptually similar to a groupBy into a Multimap followed by injectInto on each collection of values, finally yielding a MapIterable. The third parameter, a Function0 named factory, creates the initial value for each aggregation (the accumulator used by injectInto).

    Aggregate values are allowed to be immutable since they are replaced in the map.

    Function0<Integer> factory = new Function0<Integer>()
    {
        public Integer value()
        {
            return Integer.valueOf(0);
        }
    };
    Function2<Integer, Integer, Integer> sumAggregator = new Function2<Integer, Integer, Integer>()
    {
        public Integer value(Integer aggregate, Integer value)
        {
            return aggregate + value;
        }
    };
    
    Function<Integer, Integer> groupBy = new Function<Integer, Integer>()
    {
        public Integer valueOf(Integer integer)
        {
            return integer % 2;
        }
    };
    FastList<Integer> integers = FastList.newListWith(1, 1, 1, 2, 2, 3);
    MutableMap<Integer, Integer> aggregation = integers.aggregateBy(groupBy, factory, sumAggregator);
    Assert.assertEquals(4, aggregation.get(0).intValue());
    Assert.assertEquals(6, aggregation.get(1).intValue());
    

    RichIterable.aggregateInPlaceBy()

    Conceptually similar to aggregateBy, but aggregateInPlaceBy mutates values in the result map instead of replacing them. The aggregator parameter is a Procedure2 instead of a Function2.

    Function0<AtomicInteger> factory = new Function0<AtomicInteger>()
    {
        public AtomicInteger value()
        {
            return new AtomicInteger(0);
        }
    };
    Procedure2<AtomicInteger, Integer> sumAggregator = new Procedure2<AtomicInteger, Integer>()
    {
        public void value(AtomicInteger aggregate, Integer value)
        {
            aggregate.addAndGet(value);
        }
    };
    
    Function<Integer, Integer> groupBy = new Function<Integer, Integer>()
    {
        public Integer valueOf(Integer integer)
        {
            return integer % 2;
        }
    };
    FastList<Integer> integers = FastList.newListWith(1, 1, 1, 2, 2, 3);
    MutableMap<Integer, AtomicInteger> aggregation = integers.aggregateInPlaceBy(groupBy, factory, sumAggregator);
    Assert.assertEquals(4, aggregation.get(0).intValue());
    Assert.assertEquals(6, aggregation.get(1).intValue());
    

    RichIterable.noneSatisfy()

    Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty, otherwise it returns false. It's conceptually similar to RichIterable.allSatisfy(Predicates.not(predicate)).

    Assert.assertFalse(IntArrayList.newListWith(1, 2, 3).noneSatisfy(IntPredicates.greaterThan(0)));
    Assert.assertTrue(IntArrayList.newListWith(1, 2, 3).noneSatisfy(IntPredicates.greaterThan(3)));
    

    ListIterable.distinct()

    Returns a new ListIterable containing the distinct elements in the list. It's conceptually similar to toSet().toList() but it retains the original order. If an element appears multiple times in the list, only the first one will be copied into the result.

    Verify.assertListsEqual(Lists.mutable.of(5, 2, 3, 4), Lists.mutable.of(5, 2, 3, 5, 4, 2).distinct());
    

    FastList.newWithNValues()

    Returns a new FastList containing N values generated by calling the Function0 N times.

    Assert.assertEquals(FastList.newListWith(1, 1, 1, 1, 1), FastList.newWithNValues(5, Functions0.value(1)))
    

    Bag.selectByOccurrences()

    Returns all elements of the bag that have a number of occurrences that satisfy the predicate.

    MutableBag<Integer> integers = Bags.mutable.of(1, 1, 1, 1, 2, 2, 2, 3, 3, 4);
    Assert.assertEquals(Bags.mutable.of(1, 1, 1, 1, 3, 3), integers.selectByOccurrences(IntPredicates.isEven()));
    

    Bag.toStringOfItemToCount()

    Returns a string representation of the bag. It's conceptually the same as Bag.toMapOfItemToCount().toString() but without creating the intermediate map.

    Assert.assertEquals("{}", Bags.mutable.of().toStringOfItemToCount());
    Assert.assertEquals("{1=3}", Bags.mutable.of(1, 1, 1).toStringOfItemToCount());
    

    MutableMap.updateValue() and MutableMap.updateValueWith()

    Looks up the value associated with the given key, applies the Function to it, and replaces the value. If there is no value associated with the key, starts it off with a value supplied by the factory Function0. updateValueWith() is the same as updateValue() with a Function2 and an extra parameter which is passed as a second argument to the function.

    MutableMap<String, Integer> integers = UnifiedMap.newWithKeysValues("two", 2, "three", 3);
    integers.updateValue("two", Functions0.value(1), Functions.squaredInteger());
    Assert.assertEquals(UnifiedMap.newWithKeysValues("two", 4, "three", 3), integers);
    integers.updateValue("four", Functions0.value(4), Functions.squaredInteger());
    Assert.assertEquals(UnifiedMap.newWithKeysValues("two", 4, "three", 3, "four", 16), integers);
    
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Sep 11, 2013)

    Binaries

    gs-collections-2.0.0.zip

    Javadoc

    2.0.0 Javadoc

    JDiff

    API differences between 1.2.0 and 2.0.0

    New Functionality

    Stack Container

    A stack is a collection enforcing a last-in, first-out order; its methods iterate over elements beginning with the most-recently added element.

    The StackIterable interface extends RichIterable and its methods such as forEach and toString process elements in reverse order of their addition to the stack. MutableStack extends StackIterable and adds mutating methods like push, pop, and clear.

    The concrete type is ArrayStack. The current implementation delegates to a FastList and thus has similar runtime complexity. For example, ArrayStack's push method takes amortized constant time, like FastList's add method. In GS Collections, stacks are not lists. This is a deliberate difference from java.util.Stack which extends Vector.

    push Adds a new element to the top of the stack.
    pop Returns the top (most recently-added) element and removes it from the collection
    pop(int count) Returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack.
    peek Returns but does not remove the top element. Note that, on a stack, getFirst likewise returns the top element, and that getLast throws an exception.
    peek(int count) Returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack; does not remove the elements from the stack.
    peekAt(int index) Returns the element at index.

    To create a MutableStack, use one of the following static factory methods:

    MutableStack<Integer> emptyStack = ArrayStack.newStack();
    MutableStack<Integer> mutableStack = ArrayStack.newStackWith(1, 2, 3);
    MutableStack<Integer> stackFromFastList = ArrayStack.newStack(FastList.newListWith(1, 2, 3));
    MutableStack<Integer> stackFromTopToBottom = ArrayStack.newStackFromTopToBottom(3, 2, 1);
    MutableStack<Integer> stackUsingStacksFactory = Stacks.mutable.of(1, 2, 3);
    

    ConcurrentHashMap

    GS Collections 2.0 includes a new concurrent hashmap implementation, com.gs.collections.impl.map.mutable.ConcurrentHashMap.

    Primitive Iterables and their Lazy Implementations

    The primitive iterable interfaces are memory-optimized for primitives.

    int IntIterable
    long LongIterable
    float FloatIterable
    double DoubleIterable

    They are inspired by the RichIterable interface, and contain a subset of the iteration pattern methods from RichIterable like collect. They add some primitive specific API like sum, average, etc. They also include Iterators specialized for each primitive type. They do not extend Iterator, to prevent accidental auto-boxing.

    The current implementations use lazy evaluation. Here's an example which calculates the average of a collection of ints.

    double average = Interval.oneTo(4).collectInt(PrimitiveFunctions.unboxIntegerToInt()).average();
    

    Here, conllectInt() returns an instance of CollectIntIterable, an implementation of IntIterable. CollectIntIterable transforms a source iterable using an IntFunction as it iterates.

    The PrimitiveFunctions class has a number of common unboxing functions. For example PrimitiveFunctions.unboxIntegerToInt() returns an IntFunction.

    More RichIterable API

    selectInstancesOf()

    Returns all elements of the source collection that are instances of the Class parameter.

    MutableList<Number> numbers = FastList.newListWith(1.0, 2, 3.0, 4, 5.0);
    MutableList<Integer> integers = numbers.selectInstancesOf(Integer.class);
    

    It is meant to address this problem with select and an “instanceOf” Predicate.

    MutableList<Number> numbers = FastList.newListWith(1.0, 2, 3.0, 4, 5.0);
    MutableList<Number> integers = numbers.select(Predicates.instanceOf(Integer.class));
    

    The result is a collection of Number instead of Integer. If we try to add a simple cast, we get a compiler error.

    MutableList<Integer> integers = (MutableList<Integer>) numbers.select(Predicates.instanceOf(Integer.class));
    

    The error message tells us we’re trying to cast to an inconvertible type. We can use raw types, or do a double cast, but neither is intuitive.

    MutableList<Integer> integers = (MutableList<Integer>) (MutableList<?>) numbers.select(Predicates.instanceOf(Integer.class));
    

    The new method selectInstancesOf() addresses these problems with types, plus and it’s concise and communicates what you’re doing.

    sumOf() Methods - sumOfInt(), sumOfLong(), sumOfFloat(), sumOfDouble()

    The sumOf methods return the final primitive result of evaluating function for each element of the iterable and adding elements together. For example, sumOfInt() takes an IntFunction and returns the int sum without auto-boxing.

    Source code(tar.gz)
    Source code(zip)
Client for anarchy servers that has bots / auto-modules and other stuff.

AutoBot is a module styled client for anarchy servers that offers bots and auto-modules like ElytraBot which is a pathfinding bot for elytras

null 43 Dec 27, 2022
Java Collections till the last breadcrumb of memory and performance

Koloboke A family of projects around collections in Java (so far). The Koloboke Collections API A carefully designed extension of the Java Collections

Roman Leventov 967 Nov 14, 2022
GS Collections has been migrated to the Eclipse Foundation, re-branded as Eclipse Collections. https://www.eclipse.org/collections/

GS Collections is now Eclipse Collections We are pleased to announce that GS Collections has been migrated to the Eclipse Foundation, re-branded as Ec

null 1.8k Dec 30, 2022
Eclipse Foundation 3k Dec 31, 2022
https://www.spigotmc.org/resources/deluxeasyncjoinleavemessage-fully-optimized-async-everything-open-source.88129/

https://www.spigotmc.org/resources/deluxeasyncjoinleavemessage-fully-optimized-async-everything-open-source.88129/ Events: PrePreAsyncJoinPlayerEvent

null 26 Jan 4, 2023
A beta mindustry mod, this mod not uploaded on mindustry until a new release has been released

Project EPL A beta mindustry mod, this mod not uploaded on mindustry until a new release has been released. the way you can compile/implement it is in

ExplerHD 2 Feb 4, 2022
The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker.

gke-springboot-sampleapp ?? The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker. Usage To be

KYEONGMIN CHO 1 Feb 1, 2022
A basic implementation of a Ray Tracer that has been developed for the course GFX

This is a basic implementation of a Ray Tracer that has been developed for the course "GFX - Foundations of Computer Graphics" at the University of Vienna.

null 2 Mar 4, 2022
Presti 5 Nov 19, 2022
Eclipse Collections is a collections framework for Java with optimized data structures and a rich, functional and fluent API.

English | 中文 | Deutsch | Español | Ελληνικά | Français | 日本語 | Norsk (bokmål) | Português-Brasil | Русский | हिंदी Eclipse Collections is a comprehens

Eclipse Foundation 2.1k Jan 5, 2023
Eclipse Collections is a collections framework for Java with optimized data structures and a rich, functional and fluent API.

English | 中文 | Deutsch | Español | Ελληνικά | Français | 日本語 | Norsk (bokmål) | Português-Brasil | Русский | हिंदी Eclipse Collections is a comprehens

Eclipse Foundation 2.1k Dec 29, 2022
The clickgui used in my Minecraft Hacked Client, Ozone. Uses HeroCode Settings but can easily be migrated to another settings system.

OzoneClickGUI The clickgui used in my Minecraft Hacked Client, Ozone. Uses HeroCode Settings but can easily be migrated to another settings system. Pl

ShadeDev 9 Dec 2, 2022
A Zombie invasion has occurred at the Code Academy Campus and now Alcatrinha has to fight the zombies to death! (2D TopView Shooter)

Hello everyone, welcome to Zombie ACADalypse!! A Zombie invasion has occurred at the Code Academy Campus and now Alcatrinha has to fight the zombies t

Mario Vieria 1 Dec 17, 2021
A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin

Spark - a tiny web framework for Java 8 Spark 2.9.3 is out!! Changeset <dependency> <groupId>com.sparkjava</groupId> <artifactId>spark-core</a

Per Wendel 9.4k Dec 29, 2022
🍏 A collection of partial JNA bindings for various macOS frameworks. (e.g. Foundation, AppKit, etc.)

JNApple ?? A collection of partial JNA bindings for various macOS frameworks. (e.g. Foundation, AppKit, etc.) Usage These are just some common example

Iridescent 3 Jun 19, 2022
My task for " The Sparks Foundation

MyBank This is a Sparks Foundation GRIP (Graduate Rotational Internship Program) Technology Task. Task 2: Basic Banking App ◇ Create a simple mobile a

Sanjeev 1 Oct 19, 2021
Non-Blocking Reactive Foundation for the JVM

Reactor Core Non-Blocking Reactive Streams Foundation for the JVM both implementing a Reactive Extensions inspired API and efficient event streaming s

Reactor 4.4k Dec 30, 2022
MessagePack serializer implementation for Java / msgpack.org[Java]

MessagePack for Java MessagePack is a binary serialization format. If you need a fast and compact alternative of JSON, MessagePack is your friend. For

MessagePack 1.3k Dec 31, 2022