Package com.here.platform.location.core
Class Utils.BinarySearchOps<T>
java.lang.Object
com.here.platform.location.core.Utils.BinarySearchOps<T>
- Enclosing class:
- Utils
Provides binary search operations on an indexed sequence.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<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.
-
Constructor Details
-
BinarySearchOps
-
-
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.
-