base/common/src/main/com/thesett/common/util/maps/CircularArrayMap.java
private void expand(int key)
    {
        // Set the new size to whichever is the larger of 1.5 times the old size, or an array large enough to hold
        // the proposed key that caused the expansion.
        int newFactorSize = ((length * 3) / 2) + 1;
        int newSpaceSize = spaceRequired(key);

        int newSize = (newSpaceSize > newFactorSize) ? newSpaceSize : newFactorSize;

        Object[] oldData = data;
        data = new Object[newSize];

        // The valid data in the old array runs from offset(start) to offset(end) when offset(start) < offset(end), and
        // from offset(start) to length - 1 and 0 to offset(end) when offset(start) >= offset(end).
        int offsetStart = offset(start);
        int offsetEnd = offset(end);

        if (offsetStart < offsetEnd)
        {
            System.arraycopy(oldData, offsetStart, data, 0, end - start);
        }
        else
        {
            System.arraycopy(oldData, offsetStart, data, 0, length - offsetStart);
            System.arraycopy(oldData, 0, data, length - offsetStart, offsetEnd);
        }

        offset = -start;
        length = newSize;
    }
private void expand(int key)
    {
        // Set the new size to whichever is the larger of 1.5 times the old size, or an array large enough to hold
        // the proposed key that caused the expansion.
        int newFactorSize = ((length * 3) / 2) + 1;
        int newSpaceSize = spaceRequired(key);

        int newSize = (newSpaceSize > newFactorSize) ? newSpaceSize : newFactorSize;

        Object[] oldData = data;
        data = new Object[newSize];

        // The valid data in the old array runs from offset(start) to offset(end) when offset(start) < offset(end), and
        // from offset(start) to length - 1 and 0 to offset(end) when offset(start) >= offset(end).
        int offsetStart = offset(start);
        int offsetEnd = offset(end);

        if (offsetStart < offsetEnd)
        {
            System.arraycopy(oldData, offsetStart, data, 0, end - start);
        }
        else
        {
            System.arraycopy(oldData, offsetStart, data, 0, length - offsetStart);
            System.arraycopy(oldData, 0, data, length - offsetStart, offsetEnd);
        }

        offset = -start;
        length = newSize;
    }
Expands the size of the storage to whichever is the larger of 1.5 times the old size, or an array large enough to
hold the proposed key that caused the expansion, copying the old data into a new array.

@param key The key that was too large and caused expansion.