return cmprv;
}
});
for (int i = 0; i < index.size() - 1; ++i) {
RawComparable prevLastKey = index.get(i).lastKey;
RawComparable nextFirstKey = index.get(i + 1).firstKey;
if (nextFirstKey == null) {
continue;
}
if (comparator.compare(prevLastKey, nextFirstKey) > 0) {
throw new IOException("Overlapping key ranges");
}
}
}
else {
// sort by name
Collections.sort(index, new Comparator<CGIndexEntry>() {
@Override
public int compare(CGIndexEntry o1, CGIndexEntry o2) {
return o1.name.compareTo(o2.name);
}
});
}
// update status
if ((!dirty) && (index.size() > 0)) {
RawComparable keyFirst = index.get(0).getFirstKey();
status.beginKey = new BytesWritable();
status.beginKey.set(keyFirst.buffer(), keyFirst.offset(), keyFirst
.size());
RawComparable keyLast = index.get(index.size() - 1).getLastKey();
status.endKey = new BytesWritable();
status.endKey.set(keyLast.buffer(), keyLast.offset(), keyLast.size());
}
sorted = true;
}