static private int indexOfBytes(List<byte[]> list, byte[] compareTo) {
    int listIndex = 0;
    for (byte[] elem : list) {
      if (Bytes.BYTES_COMPARATOR.compare(elem, compareTo) == 0) {
        return listIndex;
      }
      listIndex++;
    }
    return -1;
  }
List.indexOf() doesn't really work for a List&lt;byte[]>, because byte[] doesn't override
equals(). This method checks whether a list contains a given element by checking each element
using the byte array comparator.
@return the index of the first element that equals compareTo, or -1 if no elements are equal.
hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java