ArrayHolder<K, V> replace(int index, COWEntry<K, V> newEntry) {
      // TODO should this restart the array back at start index 0 ?
      COWEntry<K, V>[] newEntries = entries.clone();
      newEntries[index] = newEntry;
      return new ArrayHolder<>(newEntries, startIndex, endIndex, keyComparator, comparator);
    }
Binary search for a given key
@param needle The key to look for in all of the entries
@return Same return value as Arrays.binarySearch. Positive numbers mean the index. Otherwise
        (-1 * insertion point) - 1
hbase-common/src/main/java/org/apache/hadoop/hbase/types/CopyOnWriteArrayMap.java