ArrayHolder<K, V> insert(int index, COWEntry<K, V> newEntry) {
      COWEntry<K, V>[] newEntries = new COWEntry[getLength() + 1];
      System.arraycopy(this.entries, startIndex, newEntries, 0, index - startIndex);
      newEntries[index] = newEntry;
      System.arraycopy(this.entries, index, newEntries, index + 1, getLength() - index);
      return new ArrayHolder<>(newEntries, 0, newEntries.length, 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