I was wondering if it is possible to find the closest element in a List for a element that is not there.
For example if we had the valu
You need Array.binarySearch, docs.
Returns: index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the array: the index of the first element greater than the key, or a.length if all elements in the array are less than the specified key.