Class Distinct<T>

java.lang.Object
org.dmfs.jems2.iterable.DelegatingIterable<T>
org.dmfs.jems2.iterable.Distinct<T>
All Implemented Interfaces:
Iterable<T>

public final class Distinct<T> extends DelegatingIterable<T>
An Iterator which drops duplicates of already iterated elements.

Examples

 Distinct([1, 2, 2, 1, 2, 3, 3]) ->
 [1, 2, 3]

 Distinct(String::length, ["abc", "xyz", "42", "21"]) ->
 ["abc", "42"]
 
  • Constructor Details

    • Distinct

      public Distinct(Iterable<T> delegate)
    • Distinct

      public Distinct(Function<? super T,? extends V> criterionFunction, Iterable<T> delegate)