public static Object[] replaceKey(final Object[] keyValues, final Object oldKey, final Object newKey) {
        final Object[] kvs = new Object[keyValues.length];
        for (int i = 0; i < keyValues.length; i = i + 2) {
            if (keyValues[i].equals(oldKey))
                kvs[i] = newKey;
            else
                kvs[i] = keyValues[i];
            kvs[i + 1] = keyValues[i + 1];
        }

        return kvs;
    }
Replaces one key with a different key.

@param keyValues the list of key/values to alter
@param oldKey    the key to replace
@param newKey    the new key
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java