Class BinarySearch.IntRange.InCollection.ByKey

java.lang.Object
io.smallrye.common.search.BinarySearch.IntRange.InCollection.ByKey
Enclosing class:
BinarySearch.IntRange.InCollection

public static final class BinarySearch.IntRange.InCollection.ByKey extends Object
Search operations within a collection which operate on an extracted key.
  • Method Summary

    Modifier and Type
    Method
    Description
    <C, K> int
    find(C collection, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor, Predicate<K> keyTester)
    Get the lowest index within the given range that satisfies the given test.
    <C, K, V> int
    find(C collection, V searchVal, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor, BiPredicate<V,K> keyTester)
    Get the lowest index within the given range that satisfies the given test for the search value.
    <C, K extends Comparable<? super K>>
    int
    findFirst(C collection, K searchKey, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor)
    Get the lowest index within the given range whose key is equal to or greater than the search key, according to the natural order of the search space.
    <C, K> int
    findFirst(C collection, K searchKey, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor, Comparator<? super K> cmp)
    Get the lowest index within the given range whose key is equal to or greater than the search key, according to the given comparator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • find

      public <C, K> int find(C collection, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor, Predicate<K> keyTester)
      Get the lowest index within the given range that satisfies the given test.
      Type Parameters:
      C - the collection type
      K - the key type
      Parameters:
      collection - the collection object (must not be null)
      from - the low end of the range (inclusive)
      to - the high end of the range (exclusive)
      keyExtractor - the key extraction function (must not be null)
      keyTester - the test for the key (must not be null)
      Returns:
      the lowest index within the range which satisfies the test, or to if no values satisfy the test within the range
    • find

      public <C, K, V> int find(C collection, V searchVal, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor, BiPredicate<V,K> keyTester)
      Get the lowest index within the given range that satisfies the given test for the search value.
      Type Parameters:
      C - the collection type
      K - the key type
      V - the value type
      Parameters:
      collection - the collection object (must not be null)
      searchVal - the value to search for
      from - the low end of the range (inclusive)
      to - the high end of the range (exclusive)
      keyExtractor - the key extraction function (must not be null)
      keyTester - the test for the key (must not be null)
      Returns:
      the lowest index within the range which satisfies the test, or to if no values satisfy the test within the range
    • findFirst

      public <C, K extends Comparable<? super K>> int findFirst(C collection, K searchKey, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor)
      Get the lowest index within the given range whose key is equal to or greater than the search key, according to the natural order of the search space.
      Type Parameters:
      C - the collection type
      K - the key type
      Parameters:
      collection - the collection object (must not be null)
      searchKey - the key to search for (must not be null)
      from - the low end of the range (inclusive)
      to - the high end of the range (exclusive)
      keyExtractor - the key extraction function (must not be null)
      Returns:
      the lowest index within the range which satisfies the condition, or to if no values satisfy the condition within the range
    • findFirst

      public <C, K> int findFirst(C collection, K searchKey, int from, int to, io.smallrye.common.function.ObjIntFunction<C,K> keyExtractor, Comparator<? super K> cmp)
      Get the lowest index within the given range whose key is equal to or greater than the search key, according to the given comparator.
      Type Parameters:
      C - the collection type
      K - the key type
      Parameters:
      collection - the collection object (must not be null)
      searchKey - the key to search for (must not be null)
      from - the low end of the range (inclusive)
      to - the high end of the range (exclusive)
      keyExtractor - the key extraction function (must not be null)
      cmp - the comparator (must not be null)
      Returns:
      the lowest index within the range which satisfies the condition, or to if no values satisfy the condition within the range