GithubHelp home page GithubHelp logo

pkdevboxy / eclipse-collections Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eclipse/eclipse-collections

0.0 2.0 0.0 3.35 MB

The Eclipse Collections Project

Home Page: http://www.eclipse.org/collections

HTML 0.10% Java 98.65% Scala 1.25%

eclipse-collections's Introduction

Eclipse Collections

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

Quick Example

Eclipse 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 Eclipse 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 Eclipse 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

License

Eclipse Collections is open sourced under the Eclipse Public License v1.0 and the Eclipse Distribution License v1.0.

How to Contribute

We welcome contributions!

We accept contributions via pull requests here in GitHub. Please see How To Contribute to get started.

Project Roadmap

https://github.com/eclipse/eclipse-collections/wiki/Roadmap

Acquiring Eclipse Collections

Maven

<dependency>
  <groupId>org.eclipse.collections</groupId>
  <artifactId>eclipse-collections-api</artifactId>
  <version>7.0.0</version>
</dependency>

<dependency>
  <groupId>org.eclipse.collections</groupId>
  <artifactId>eclipse-collections</artifactId>
  <version>7.0.0</version>
</dependency>

<dependency>
  <groupId>org.eclipse.collections</groupId>
  <artifactId>eclipse-collections-testutils</artifactId>
  <version>7.0.0</version>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>org.eclipse.collections</groupId>
  <artifactId>eclipse-collections-forkjoin</artifactId>
  <version>7.0.0</version>
</dependency>

Gradle

compile 'org.eclipse.collections:eclipse-collections-api:7.0.0'
compile 'org.eclipse.collections:eclipse-collections:7.0.0'
testCompile 'org.eclipse.collections:eclipse-collections-testutils:7.0.0'
compile 'org.eclipse.collections:eclipse-collections-forkjoin:7.0.0'

Ivy

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

Additional information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.