Package 

Class LookupSet

  • All Implemented Interfaces:
    kotlin.collections.Collection , kotlin.collections.Iterable , kotlin.collections.Set

    
    public final class LookupSet<T extends Object>
     implements Set<T>
                        

    Simple lookup set. This is intended to allow the use of the in {collection} syntax with sets of values that either (1) are too simple to justify using a Set (e.g. only 2 values), or (2) require algorithmic checking (e.g. an Int is even – easy to check in an if but not easy in a when selector).

    The constructor takes a lambda parameter, a function that tests whether the value is a member of the notional "set". It is expected that only the contains function will be used, mostly from the in or !in construct.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Integer size
      private final Function1<T, Boolean> check
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Integer getSize()
      final Function1<T, Boolean> getCheck()
      Boolean isEmpty()
      Iterator<T> iterator()
      Boolean contains(T element)
      Boolean containsAll(Collection<T> elements)
      • Methods inherited from class kotlin.collections.Iterable

        forEach
      • Methods inherited from class kotlin.collections.Collection

        parallelStream, stream, toArray
      • Methods inherited from class kotlin.collections.Set

        spliterator
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait