A comprehensive collections library for Java delivering productivity and performance through an expressive and efficient set of APIs and types.
—
Eclipse Collections provides a comprehensive hierarchy of collection interfaces built around the RichIterable foundation. This hierarchy includes both mutable and immutable variants for all collection types, offering over 200 methods for functional programming operations.
Base interfaces that form the foundation of all Eclipse Collections.
/**
* Base interface for all Eclipse Collections providing iteration capabilities
*/
interface InternalIterable<T> {
/**
* Execute procedure for each element
* @param procedure procedure to execute
*/
void forEach(Procedure<? super T> procedure);
/**
* Execute procedure for each element with additional parameter
* @param procedure procedure to execute
* @param parameter additional parameter passed to procedure
*/
<P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter);
/**
* Execute procedure for each element with index
* @param objectIntProcedure procedure receiving element and index
*/
void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure);
}
/**
* Primary read-only interface extending InternalIterable with rich functionality
* Provides over 200 methods for functional programming operations
*/
interface RichIterable<T> extends InternalIterable<T> {
// Size and testing methods
int size();
boolean isEmpty();
boolean notEmpty();
// Element testing
boolean contains(Object object);
boolean containsAll(Collection<?> source);
boolean containsAllArguments(Object... elements);
// Predicate testing
boolean anySatisfy(Predicate<? super T> predicate);
boolean allSatisfy(Predicate<? super T> predicate);
boolean noneSatisfy(Predicate<? super T> predicate);
<P> boolean anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter);
<P> boolean allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter);
<P> boolean noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter);
// Counting
int count(Predicate<? super T> predicate);
<P> int countWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> Bag<V> countBy(Function<? super T, ? extends V> function);
<V, P> Bag<V> countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
// Element retrieval
T getFirst();
T getLast();
T getAny();
T getOnly();
// Detection/finding
T detect(Predicate<? super T> predicate);
<P> T detectWith(Predicate2<? super T, ? super P> predicate, P parameter);
Optional<T> detectOptional(Predicate<? super T> predicate);
<P> Optional<T> detectOptionalWith(Predicate2<? super T, ? super P> predicate, P parameter);
T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function);
<P> T detectWithIfNone(Predicate2<? super T, ? super P> predicate, P parameter, Function0<? extends T> function);
// Min/Max operations
T min(Comparator<? super T> comparator);
T max(Comparator<? super T> comparator);
T min();
T max();
<V extends Comparable<? super V>> T minBy(Function<? super T, ? extends V> function);
<V extends Comparable<? super V>> T maxBy(Function<? super T, ? extends V> function);
// Filtering operations
RichIterable<T> select(Predicate<? super T> predicate);
<P> RichIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
RichIterable<T> reject(Predicate<? super T> predicate);
<P> RichIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<S> RichIterable<S> selectInstancesOf(Class<S> clazz);
// Partitioning
PartitionIterable<T> partition(Predicate<? super T> predicate);
<P> PartitionIterable<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter);
// Transformation operations
<V> RichIterable<V> collect(Function<? super T, ? extends V> function);
<P, V> RichIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
<V> RichIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
<V> RichIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
// Primitive collection operations
BooleanIterable collectBoolean(BooleanFunction<? super T> booleanFunction);
ByteIterable collectByte(ByteFunction<? super T> byteFunction);
CharIterable collectChar(CharFunction<? super T> charFunction);
DoubleIterable collectDouble(DoubleFunction<? super T> doubleFunction);
FloatIterable collectFloat(FloatFunction<? super T> floatFunction);
IntIterable collectInt(IntFunction<? super T> intFunction);
LongIterable collectLong(LongFunction<? super T> longFunction);
ShortIterable collectShort(ShortFunction<? super T> shortFunction);
// Grouping operations
<V> Multimap<V, T> groupBy(Function<? super T, ? extends V> function);
<V> Multimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function);
<V> MapIterable<V, T> groupByUniqueKey(Function<? super T, ? extends V> function);
// Aggregation operations
<IV> IV injectInto(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function);
<P, IV> IV injectIntoWith(IV injectedValue, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter);
// Numeric aggregations
long sumOfInt(IntFunction<? super T> function);
double sumOfFloat(FloatFunction<? super T> function);
long sumOfLong(LongFunction<? super T> function);
double sumOfDouble(DoubleFunction<? super T> function);
// Java 8 Stream integration
Optional<T> reduce(BinaryOperator<T> accumulator);
T reduce(T identity, BinaryOperator<T> accumulator);
<U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner);
// Advanced aggregation
<K, V> MapIterable<K, V> aggregateInPlaceBy(
Function<? super T, ? extends K> groupBy,
Function0<? extends V> zeroValueFactory,
Procedure2<? super V, ? super T> mutatingAggregator);
<K, V> MapIterable<K, V> aggregateBy(
Function<? super T, ? extends K> groupBy,
Function0<? extends V> zeroValueFactory,
Function2<? super V, ? super T, ? extends V> nonMutatingAggregator);
// Utility methods
RichIterable<RichIterable<T>> chunk(int size);
RichIterable<T> tap(Procedure<? super T> procedure);
void each(Procedure<? super T> procedure);
<P> void forEachWith(Procedure2<? super T, ? super P> procedure, P parameter);
// Lazy evaluation
LazyIterable<T> asLazy();
// Conversion methods
MutableList<T> toList();
MutableList<T> toSortedList();
MutableList<T> toSortedList(Comparator<? super T> comparator);
<V extends Comparable<? super V>> MutableList<T> toSortedListBy(Function<? super T, ? extends V> function);
MutableSet<T> toSet();
MutableSortedSet<T> toSortedSet();
MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator);
<V extends Comparable<? super V>> MutableSortedSet<T> toSortedSetBy(Function<? super T, ? extends V> function);
MutableBag<T> toBag();
MutableSortedBag<T> toSortedBag();
MutableSortedBag<T> toSortedBag(Comparator<? super T> comparator);
<V extends Comparable<? super V>> MutableSortedBag<T> toSortedBagBy(Function<? super T, ? extends V> function);
<NK, NV> MutableMap<NK, NV> toMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction);
<NK, NV> MutableSortedMap<NK, NV> toSortedMap(Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction);
<NK, NV> MutableSortedMap<NK, NV> toSortedMap(Comparator<? super NK> comparator, Function<? super T, ? extends NK> keyFunction, Function<? super T, ? extends NV> valueFunction);
// Immutable conversion methods
ImmutableList<T> toImmutableList();
ImmutableSet<T> toImmutableSet();
ImmutableBag<T> toImmutableBag();
ImmutableSortedSet<T> toImmutableSortedSet();
ImmutableSortedSet<T> toImmutableSortedSet(Comparator<? super T> comparator);
ImmutableSortedBag<T> toImmutableSortedBag();
ImmutableSortedBag<T> toImmutableSortedBag(Comparator<? super T> comparator);
// Array conversion
Object[] toArray();
<E> E[] toArray(E[] array);
// String methods
String makeString();
String makeString(String separator);
String makeString(String start, String separator, String end);
void appendString(Appendable appendable);
void appendString(Appendable appendable, String separator);
void appendString(Appendable appendable, String start, String separator, String end);
}Usage Examples:
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.impl.factory.Lists;
MutableList<Person> people = Lists.mutable.with(
new Person("Alice", 25),
new Person("Bob", 30),
new Person("Charlie", 35)
);
// Filtering operations
RichIterable<Person> adults = people.select(person -> person.getAge() >= 18);
RichIterable<Person> youngAdults = people.selectWith((person, minAge) -> person.getAge() >= minAge, 21);
// Transformation operations
RichIterable<String> names = people.collect(Person::getName);
RichIterable<String> upperCaseNames = people.collect(person -> person.getName().toUpperCase());
// Aggregation operations
int totalAge = people.sumOfInt(Person::getAge);
Person oldest = people.maxBy(Person::getAge);
String allNames = people.collect(Person::getName).makeString(", ");
// Counting and testing
int adultsCount = people.count(person -> person.getAge() >= 18);
boolean hasMinors = people.anySatisfy(person -> person.getAge() < 18);
boolean allAdults = people.allSatisfy(person -> person.getAge() >= 18);
// Grouping
Multimap<Integer, Person> peopleByAge = people.groupBy(Person::getAge);
MapIterable<String, Person> peopleByName = people.groupByUniqueKey(Person::getName);Interface for lazy evaluation providing deferred computation.
/**
* Lazy evaluation iterable for deferred computation
* Operations are not executed until a terminal operation is called
*/
interface LazyIterable<T> extends RichIterable<T> {
/**
* Force evaluation and return eager iterable
* @return RichIterable with computed results
*/
RichIterable<T> eager();
/**
* Get size by forcing evaluation
* @return computed size
*/
int size();
/**
* Convert to array by forcing evaluation
* @return computed array
*/
Object[] toArray();
/**
* Force evaluation and return list
* @return MutableList with computed results
*/
MutableList<T> toList();
/**
* Force evaluation and return set
* @return MutableSet with computed results
*/
MutableSet<T> toSet();
/**
* Force evaluation and return bag
* @return MutableBag with computed results
*/
MutableBag<T> toBag();
}Interface for parallel processing operations.
/**
* Interface for parallel processing operations
* Provides parallelized versions of common operations
*/
interface ParallelIterable<T> extends RichIterable<T> {
/**
* Execute procedure in parallel for each element
* @param procedure procedure to execute
*/
void forEach(Procedure<? super T> procedure);
/**
* Parallel select operation
* @param predicate predicate for filtering
* @return ParallelIterable with selected elements
*/
ParallelIterable<T> select(Predicate<? super T> predicate);
/**
* Parallel reject operation
* @param predicate predicate for filtering
* @return ParallelIterable with rejected elements
*/
ParallelIterable<T> reject(Predicate<? super T> predicate);
/**
* Parallel collect operation
* @param function transformation function
* @return ParallelIterable with transformed elements
*/
<V> ParallelIterable<V> collect(Function<? super T, ? extends V> function);
/**
* Parallel flat collect operation
* @param function function returning iterables
* @return ParallelIterable with flattened results
*/
<V> ParallelIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
}Base interfaces for mutable and immutable collections.
/**
* Base mutable collection interface extending JDK Collection
* Provides fluent API methods and Eclipse Collections functionality
*/
interface MutableCollection<T> extends Collection<T>, RichIterable<T> {
// Modification operations
boolean add(T item);
boolean remove(Object item);
boolean addAll(Collection<? extends T> source);
boolean addAllIterable(Iterable<? extends T> iterable);
boolean removeAll(Collection<?> collection);
boolean retainAll(Collection<?> collection);
void clear();
// Fluent API methods
MutableCollection<T> with(T element);
MutableCollection<T> without(T element);
MutableCollection<T> withAll(Iterable<? extends T> elements);
MutableCollection<T> withoutAll(Iterable<? extends T> elements);
// Mutable filtering operations return new collections
MutableCollection<T> select(Predicate<? super T> predicate);
<P> MutableCollection<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
MutableCollection<T> reject(Predicate<? super T> predicate);
<P> MutableCollection<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
// Mutable transformation operations
<V> MutableCollection<V> collect(Function<? super T, ? extends V> function);
<P, V> MutableCollection<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
<V> MutableCollection<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
<V> MutableCollection<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
// Iterator with removal support
Iterator<T> iterator();
// Parallel processing
ParallelIterable<T> asParallel(ExecutorService executorService, int batchSize);
}
/**
* Base immutable collection interface
* All modification operations return new immutable instances
*/
interface ImmutableCollection<T> extends RichIterable<T> {
/**
* Create new collection with additional element
* @param element element to add
* @return new ImmutableCollection with element added
*/
ImmutableCollection<T> newWith(T element);
/**
* Create new collection with multiple additional elements
* @param elements elements to add
* @return new ImmutableCollection with elements added
*/
ImmutableCollection<T> newWithAll(Iterable<? extends T> elements);
/**
* Create new collection without specified element
* @param element element to remove
* @return new ImmutableCollection with element removed
*/
ImmutableCollection<T> newWithout(T element);
/**
* Create new collection without specified elements
* @param elements elements to remove
* @return new ImmutableCollection with elements removed
*/
ImmutableCollection<T> newWithoutAll(Iterable<? extends T> elements);
// Immutable filtering operations
ImmutableCollection<T> select(Predicate<? super T> predicate);
<P> ImmutableCollection<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
ImmutableCollection<T> reject(Predicate<? super T> predicate);
<P> ImmutableCollection<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
// Immutable transformation operations
<V> ImmutableCollection<V> collect(Function<? super T, ? extends V> function);
<P, V> ImmutableCollection<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
<V> ImmutableCollection<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
<V> ImmutableCollection<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
}Comprehensive list interfaces providing indexed access and ordering.
/**
* Base list interface providing indexed access and ordering
*/
interface ListIterable<T> extends RichIterable<T>, OrderedIterable<T> {
// Indexed access
T get(int index);
// Index-based search
int indexOf(Object object);
int lastIndexOf(Object object);
// List-specific operations
ListIterable<T> select(Predicate<? super T> predicate);
<P> ListIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
ListIterable<T> reject(Predicate<? super T> predicate);
<P> ListIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> ListIterable<V> collect(Function<? super T, ? extends V> function);
<P, V> ListIterable<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
<V> ListIterable<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
<V> ListIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
// Partitioning
PartitionList<T> partition(Predicate<? super T> predicate);
<P> PartitionList<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter);
// List conversion
MutableList<T> toList();
ImmutableList<T> toImmutableList();
}
/**
* Mutable list interface extending JDK List
*/
interface MutableList<T> extends MutableCollection<T>, List<T>, ListIterable<T>, Cloneable {
// JDK List operations
void add(int index, T element);
boolean addAll(int index, Collection<? extends T> collection);
T get(int index);
T set(int index, T element);
T remove(int index);
// Eclipse Collections enhancements
MutableList<T> with(T element);
MutableList<T> without(T element);
MutableList<T> withAll(Iterable<? extends T> elements);
MutableList<T> withoutAll(Iterable<? extends T> elements);
// In-place operations
MutableList<T> sortThis();
MutableList<T> sortThis(Comparator<? super T> comparator);
<V extends Comparable<? super V>> MutableList<T> sortThisBy(Function<? super T, ? extends V> function);
MutableList<T> reverseThis();
MutableList<T> shuffleThis();
MutableList<T> shuffleThis(Random rnd);
// Sublist operations
MutableList<T> subList(int fromIndex, int toIndex);
// Mutable list-specific transformations
MutableList<T> select(Predicate<? super T> predicate);
<P> MutableList<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
MutableList<T> reject(Predicate<? super T> predicate);
<P> MutableList<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> MutableList<V> collect(Function<? super T, ? extends V> function);
<P, V> MutableList<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
<V> MutableList<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
<V> MutableList<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
// Iterator with modification support
ListIterator<T> listIterator();
ListIterator<T> listIterator(int index);
// Clone support
MutableList<T> clone();
}
/**
* Immutable list interface
*/
interface ImmutableList<T> extends ImmutableCollection<T>, ListIterable<T> {
// Immutable modification operations
ImmutableList<T> newWith(T element);
ImmutableList<T> newWithAll(Iterable<? extends T> elements);
ImmutableList<T> newWithout(T element);
ImmutableList<T> newWithoutAll(Iterable<? extends T> elements);
// Immutable transformations
ImmutableList<T> select(Predicate<? super T> predicate);
<P> ImmutableList<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
ImmutableList<T> reject(Predicate<? super T> predicate);
<P> ImmutableList<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> ImmutableList<V> collect(Function<? super T, ? extends V> function);
<P, V> ImmutableList<V> collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter);
<V> ImmutableList<V> collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function);
<V> ImmutableList<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
}
/**
* Fixed-size list interface - cannot be resized
*/
interface FixedSizeList<T> extends MutableList<T> {
// All modification operations that change size throw UnsupportedOperationException
// Available: set, sort, reverse, shuffle operations
// Not available: add, remove, clear operations
}Set interfaces providing unique element collections with set algebra operations.
/**
* Base set interface providing set-specific operations
*/
interface SetIterable<T> extends RichIterable<T> {
// Set algebra operations
SetIterable<T> union(SetIterable<? extends T> set);
SetIterable<T> intersect(SetIterable<? extends T> set);
SetIterable<T> difference(SetIterable<? extends T> subtrahend);
SetIterable<T> symmetricDifference(SetIterable<? extends T> set);
// Subset operations
boolean isSubsetOf(SetIterable<? extends T> candidateSuperset);
boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset);
// Power set
SetIterable<SetIterable<T>> powerSet();
// Cartesian product
<B> LazyIterable<Pair<T, B>> cartesianProduct(SetIterable<B> set);
// Set-specific transformations
SetIterable<T> select(Predicate<? super T> predicate);
<P> SetIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
SetIterable<T> reject(Predicate<? super T> predicate);
<P> SetIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> SetIterable<V> collect(Function<? super T, ? extends V> function);
<V> SetIterable<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
}
/**
* Mutable set interface extending JDK Set
*/
interface MutableSet<T> extends MutableCollection<T>, Set<T>, SetIterable<T>, Cloneable {
// Fluent API
MutableSet<T> with(T element);
MutableSet<T> without(T element);
MutableSet<T> withAll(Iterable<? extends T> elements);
MutableSet<T> withoutAll(Iterable<? extends T> elements);
// Mutable set algebra operations (modify this set)
boolean unionInto(SetIterable<? extends T> set, MutableSet<T> targetSet);
boolean intersectInto(SetIterable<? extends T> set, MutableSet<T> targetSet);
boolean differenceInto(SetIterable<? extends T> subtrahend, MutableSet<T> targetSet);
boolean symmetricDifferenceInto(SetIterable<? extends T> set, MutableSet<T> targetSet);
// Mutable set transformations
MutableSet<T> select(Predicate<? super T> predicate);
<P> MutableSet<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
MutableSet<T> reject(Predicate<? super T> predicate);
<P> MutableSet<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> MutableSet<V> collect(Function<? super T, ? extends V> function);
<V> MutableSet<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
// Clone support
MutableSet<T> clone();
}
/**
* Immutable set interface
*/
interface ImmutableSet<T> extends ImmutableCollection<T>, SetIterable<T> {
// Immutable modification operations
ImmutableSet<T> newWith(T element);
ImmutableSet<T> newWithAll(Iterable<? extends T> elements);
ImmutableSet<T> newWithout(T element);
ImmutableSet<T> newWithoutAll(Iterable<? extends T> elements);
// Immutable transformations
ImmutableSet<T> select(Predicate<? super T> predicate);
<P> ImmutableSet<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter);
ImmutableSet<T> reject(Predicate<? super T> predicate);
<P> ImmutableSet<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter);
<V> ImmutableSet<V> collect(Function<? super T, ? extends V> function);
<V> ImmutableSet<V> flatCollect(Function<? super T, ? extends Iterable<V>> function);
}Comprehensive map interfaces providing key-value collections with rich operations.
/**
* Base map interface extending RichIterable over values
*/
interface MapIterable<K, V> extends RichIterable<V> {
// Basic map operations
V get(Object key);
boolean containsKey(Object key);
boolean containsValue(Object value);
// Enhanced get operations
V getIfAbsent(K key, Function0<? extends V> function);
V getIfAbsentValue(K key, V defaultValue);
<P> V getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter);
// Views
RichIterable<K> keysView();
RichIterable<V> valuesView();
RichIterable<Pair<K, V>> keyValuesView();
// Map-specific operations
<R> RichIterable<R> collect(Function2<? super K, ? super V, ? extends R> function);
<R> RichIterable<R> collectValues(Function<? super V, ? extends R> function);
MapIterable<K, V> select(Predicate2<? super K, ? super V> predicate);
MapIterable<K, V> reject(Predicate2<? super K, ? super V> predicate);
// Conversion
MutableMap<K, V> toMap();
ImmutableMap<K, V> toImmutable();
}
/**
* Mutable map interface extending JDK Map
*/
interface MutableMap<K, V> extends MutableMapIterable<K, V>, Map<K, V>, Cloneable {
// JDK Map operations
V put(K key, V value);
void putAll(Map<? extends K, ? extends V> map);
V remove(Object key);
void clear();
// Enhanced put operations
V getIfAbsentPut(K key, Function0<? extends V> function);
V getIfAbsentPutValue(K key, V value);
<P> V getIfAbsentPutWith(K key, Function<? super P, ? extends V> function, P parameter);
V getIfAbsentPutWithKey(K key, Function<? super K, ? extends V> function);
// Update operations
V updateValue(K key, Function0<? extends V> factory, Function<? super V, ? extends V> function);
<P> V updateValueWith(K key, Function0<? extends V> factory, Function2<? super V, ? super P, ? extends V> function, P parameter);
// Fluent API
MutableMap<K, V> withKeyValue(K key, V value);
MutableMap<K, V> withAllKeyValues(Iterable<? extends Pair<? extends K, ? extends V>> keyValuePairs);
MutableMap<K, V> withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs);
MutableMap<K, V> withoutKey(K key);
MutableMap<K, V> withoutAllKeys(Iterable<? extends K> keys);
// Mutable transformations
MutableMap<K, V> select(Predicate2<? super K, ? super V> predicate);
MutableMap<K, V> reject(Predicate2<? super K, ? super V> predicate);
<R> MutableCollection<R> collect(Function2<? super K, ? super V, ? extends R> function);
// Clone support
MutableMap<K, V> clone();
}
/**
* Immutable map interface
*/
interface ImmutableMap<K, V> extends MapIterable<K, V> {
// Immutable modification operations
ImmutableMap<K, V> newWithKeyValue(K key, V value);
ImmutableMap<K, V> newWithAllKeyValues(Iterable<? extends Pair<? extends K, ? extends V>> keyValues);
ImmutableMap<K, V> newWithAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs);
ImmutableMap<K, V> newWithoutKey(K key);
ImmutableMap<K, V> newWithoutAllKeys(Iterable<? extends K> keys);
// Immutable transformations
ImmutableMap<K, V> select(Predicate2<? super K, ? super V> predicate);
ImmutableMap<K, V> reject(Predicate2<? super K, ? super V> predicate);
}All collection interfaces follow consistent design patterns:
select/reject for filtering, collect for transformationWith methods for parameterized operationsasLazy() provides deferred computationasParallel() enables concurrent operationsInstall with Tessl CLI
npx tessl i tessl/maven-org-eclipse-collections--eclipse-collections