CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-eclipse-collections--eclipse-collections-api

A comprehensive collections framework API for Java providing interfaces for object collections, primitive collections and lazy iterables

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

Eclipse Collections API

Eclipse Collections is a comprehensive collections framework for Java that provides interfaces for object collections, primitive collections, and lazy iterables. This API module defines 238 interfaces for a rich set of collection types with extensive functional programming capabilities.

Package Information

  • Package Name: eclipse-collections-api
  • Package Type: maven
  • Language: Java
  • Installation:

Maven:

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

Gradle:

implementation 'org.eclipse.collections:eclipse-collections-api:13.0.0'

Base Package: org.eclipse.collections.api

Core Imports

// Core collection interfaces
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.ParallelIterable;

// List collections
import org.eclipse.collections.api.list.ListIterable;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.list.ImmutableList;

// Set collections
import org.eclipse.collections.api.set.SetIterable;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.set.ImmutableSet;

// Map collections
import org.eclipse.collections.api.map.MapIterable;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.map.ImmutableMap;

// Factory classes
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.factory.Sets;
import org.eclipse.collections.api.factory.Maps;

// Functional interfaces
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.procedure.Procedure;

// Ordering interfaces
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.ordered.ReversibleIterable;
import org.eclipse.collections.api.ordered.SortedIterable;

// Tuple interfaces
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.api.tuple.Triple;
import org.eclipse.collections.api.tuple.Twin;
import org.eclipse.collections.api.tuple.Triplet;

// Partition interface
import org.eclipse.collections.api.partition.PartitionIterable;

Basic Usage

Collection Creation

// Create mutable collections
MutableList<String> list = Lists.mutable.with("a", "b", "c");
MutableSet<Integer> set = Sets.mutable.with(1, 2, 3);
MutableMap<String, Integer> map = Maps.mutable.with("key1", 1, "key2", 2);

// Create immutable collections
ImmutableList<String> immutableList = Lists.immutable.with("a", "b", "c");
ImmutableSet<Integer> immutableSet = Sets.immutable.with(1, 2, 3);
ImmutableMap<String, Integer> immutableMap = Maps.immutable.with("key1", 1, "key2", 2);

Functional Operations

// Using RichIterable functional methods
RichIterable<String> names = Lists.mutable.with("John", "Jane", "Bob");

// Filter elements
RichIterable<String> filtered = names.select(name -> name.startsWith("J"));

// Transform elements
RichIterable<Integer> lengths = names.collect(String::length);

// Find elements
String found = names.detect(name -> name.contains("o"));

// Partition elements
PartitionIterable<String> partition = names.partition(name -> name.length() > 3);

Capabilities

Core Collections

Comprehensive collection interfaces including Lists, Sets, Bags, and Stacks with both mutable and immutable variants, including sorted collections.

// List operations
ListIterable<T> extends RichIterable<T>
MutableList<T> extends MutableCollection<T>, List<T>, ListIterable<T>
ImmutableList<T> extends ListIterable<T>

// Set operations with mathematical functions
SetIterable<T> extends RichIterable<T>
MutableSet<T> extends MutableCollection<T>, Set<T>, SetIterable<T>
ImmutableSet<T> extends SetIterable<T>

// Sorted set operations
SortedSetIterable<T> extends SetIterable<T>, SortedIterable<T>
MutableSortedSet<T> extends MutableSet<T>, SortedSet<T>, SortedSetIterable<T>
ImmutableSortedSet<T> extends SortedSetIterable<T>

// Bag operations (multiset with occurrence counting)
Bag<T> extends RichIterable<T>
MutableBag<T> extends MutableBagIterable<T>, Bag<T>
ImmutableBag<T> extends Bag<T>

// Sorted bag operations
SortedBag<T> extends Bag<T>, SortedIterable<T>
MutableSortedBag<T> extends MutableBag<T>, SortedBag<T>
ImmutableSortedBag<T> extends SortedBag<T>

// Stack operations (LIFO collections)
StackIterable<T> extends OrderedIterable<T>
MutableStack<T> extends MutableCollection<T>, StackIterable<T>
ImmutableStack<T> extends StackIterable<T>

Maps and Multimaps

Advanced key-value collections including traditional maps, sorted maps, multimaps for one-to-many relationships, and bidirectional maps.

// Map operations with rich functional programming
MapIterable<K,V>
MutableMap<K,V> extends Map<K,V>, MapIterable<K,V>
ImmutableMap<K,V> extends MapIterable<K,V>

// Sorted map operations
SortedMapIterable<K,V> extends MapIterable<K,V>
MutableSortedMap<K,V> extends MutableMap<K,V>, SortedMap<K,V>, SortedMapIterable<K,V>
ImmutableSortedMap<K,V> extends SortedMapIterable<K,V>

// One-to-many key-value associations
Multimap<K,V>
MutableMultimap<K,V> extends Multimap<K,V>
ImmutableMultimap<K,V> extends Multimap<K,V>

// Bidirectional one-to-one mapping
BiMap<K,V> extends MapIterable<K,V>
MutableBiMap<K,V> extends BiMap<K,V>, MutableMap<K,V>
ImmutableBiMap<K,V> extends BiMap<K,V>, ImmutableMap<K,V>

Primitive Collections

Memory-efficient primitive collections for all 8 Java primitive types, avoiding boxing overhead.

// Primitive iterables (base interfaces)
BooleanIterable, ByteIterable, CharIterable, DoubleIterable
FloatIterable, IntIterable, LongIterable, ShortIterable

// Primitive collections (example with int)
MutableIntList extends IntIterable
ImmutableIntList extends IntIterable
MutableIntSet extends IntIterable
IntIntMap // primitive-to-primitive maps
ObjectIntMap<K> // object-to-primitive maps
IntObjectMap<V> // primitive-to-object maps

Functional Interfaces

Rich functional programming support with Functions, Predicates, and Procedures for both object and primitive types.

// Core functional interfaces
Function<T,V> extends java.util.function.Function<T,V>
Function2<T1,T2,V>
Function0<V>

Predicate<T> extends java.util.function.Predicate<T>
Predicate2<T,P>

Procedure<T>
Procedure2<T,P>

// Primitive function interfaces
IntFunction<T>
IntToObjectFunction<V>
IntToIntFunction
ObjectIntPredicate<T>
IntProcedure

Lazy and Parallel Processing

Memory-efficient lazy evaluation and parallel processing capabilities for high-performance operations.

// Lazy evaluation for deferred computation
LazyIterable<T> extends RichIterable<T>

// Parallel processing with thread-safe operations
ParallelIterable<T>

Ordered Collections Hierarchy

Base interfaces providing ordering and sorting capabilities across all collection types.

// Base ordering interfaces
OrderedIterable<T> extends RichIterable<T>
ReversibleIterable<T> extends OrderedIterable<T>
SortedIterable<T> extends OrderedIterable<T>

Tuple Support

Tuple types for grouping related values with compile-time type safety.

// Core tuple interfaces
Pair<T1, T2> extends Serializable, Comparable<Pair<T1, T2>>
Triple<T1, T2, T3> extends Serializable, Comparable<Triple<T1, T2, T3>>
Twin<T> extends Pair<T, T>
Triplet<T> extends Triple<T, T, T>

Factories and Utilities

Factory classes and utility interfaces for convenient collection creation and manipulation.

// Static factory classes
Lists.mutable, Lists.immutable, Lists.fixedSize
Sets.mutable, Sets.immutable, Sets.fixedSize
Maps.mutable, Maps.immutable, Maps.fixedSize
Bags.mutable, Bags.immutable
Stacks.mutable, Stacks.immutable

// Factory interfaces
MutableListFactory
ImmutableListFactory
MutableSetFactory
ImmutableSetFactory

Key Features

  • Rich Functional Programming: Comprehensive lambda-based operations (select, collect, reject, detect, partition)
  • Immutable Collections: Thread-safe collections where operations return new instances
  • Primitive Support: Complete primitive collection support for all 8 Java primitive types
  • Lazy Evaluation: Deferred computation via LazyIterable for memory-efficient processing
  • Parallel Processing: Built-in parallel execution capabilities via ParallelIterable
  • Sorted Collections: Full support for sorted variants of Lists, Sets, Bags, and Maps
  • Tuple Support: Type-safe grouping with Pair, Triple, Twin, and Triplet interfaces
  • Mathematical Set Operations: Union, intersection, difference, symmetric difference
  • Occurrence Counting: Bag collections for multiset operations
  • Advanced Maps: Multimaps for one-to-many relationships, BiMaps for bidirectional mapping

Architecture

Eclipse Collections uses a consistent design pattern across all collection types:

  1. Base Iterable: Core functional operations (RichIterable, LazyIterable)
  2. Type-specific Iterables: Collection-specific operations (ListIterable, SetIterable, etc.)
  3. Mutable Variants: Modifiable collections extending Java standard interfaces
  4. Immutable Variants: Thread-safe collections with transformation operations
  5. Factory Pattern: Convenient creation through static factory classes

Related Documentation

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.eclipse.collections/eclipse-collections-api@13.0.x
Publish Source
CLI
Badge
tessl/maven-org-eclipse-collections--eclipse-collections-api badge