in src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java [504:525]
public DefaultConfigurationKey commonKey(final DefaultConfigurationKey other) {
if (other == null) {
throw new IllegalArgumentException("Other key must no be null!");
}
final DefaultConfigurationKey result = new DefaultConfigurationKey(getExpressionEngine());
final KeyIterator it1 = iterator();
final KeyIterator it2 = other.iterator();
while (it1.hasNext() && it2.hasNext() && partsEqual(it1, it2)) {
if (it1.isAttribute()) {
result.appendAttribute(it1.currentKey());
} else {
result.append(it1.currentKey());
if (it1.hasIndex) {
result.appendIndex(it1.getIndex());
}
}
}
return result;
}