Class Utils.BinarySearchOps<T>

java.lang.Object
com.here.platform.location.core.Utils.BinarySearchOps<T>
Enclosing class:
Utils

public static class Utils.BinarySearchOps<T> extends Object
Provides binary search operations on an indexed sequence.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BinarySearchOps(scala.collection.IndexedSeq<T> seq)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <K> scala.Option<Object>
    binarySearchBy(K keyValue, scala.Function1<T,K> getKey, scala.math.Ordering<K> ord)
    Search the index of an item based on a specific key.
    <K> scala.Option<T>
    binarySearchItemBy(K keyValue, scala.Function1<T,K> getKey, scala.math.Ordering<K> ord)
    Search an item based on a specific key.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BinarySearchOps

      public BinarySearchOps(scala.collection.IndexedSeq<T> seq)
  • Method Details

    • binarySearchBy

      public <K> scala.Option<Object> binarySearchBy(K keyValue, scala.Function1<T,K> getKey, scala.math.Ordering<K> ord)
      Search the index of an item based on a specific key.

      As a prerequisite the sequence needs to be ordered by the key.

      Parameters:
      keyValue - the key search for.
      getKey - a function to retrieve the key associated to an item.
      Returns:
      some index, if a matching item is found. None otherwise.
    • binarySearchItemBy

      public <K> scala.Option<T> binarySearchItemBy(K keyValue, scala.Function1<T,K> getKey, scala.math.Ordering<K> ord)
      Search an item based on a specific key.

      Parameters:
      keyValue - the key search for.
      getKey - a function to retrieve the key associated to an item.
      Returns:
      the item, if a match is found. None otherwise.