hollow/src/main/java/com/netflix/hollow/core/memory/encoding/FixedLengthMultipleOccurrenceElementArray.java
public void addElement(long nodeIndex, long element) {
        if (element > elementMask) {
            throw new IllegalArgumentException("Element " + element + " does not fit in "
                    + bitsPerElement + " bits");
        }
        if (nodeIndex >= numNodes) {
            throw new IllegalArgumentException("Provided nodeIndex  " + nodeIndex
                    + " greater then numNodes " + numNodes);
        }
        if (element == NO_ELEMENT) {
            // we use 0 to indicate an "empty" element, so we have to store ordinal zero here
            nodesWithOrdinalZero.setElementValue(nodeIndex, 1, 1);
            return;
        }
        long bucketStart = nodeIndex * maxElementsPerNode * bitsPerElement;
        long currentIndex;
        int offset = 0;
        do {
            currentIndex = bucketStart + offset * bitsPerElement;
            offset++;
        } while (storage.getElementValue(currentIndex, bitsPerElement, elementMask) != NO_ELEMENT
                && offset < maxElementsPerNode);
        if (storage.getElementValue(currentIndex, bitsPerElement, elementMask) != NO_ELEMENT) {
            // we're full at this index - resize, then figure out the new current index
            resizeStorage();
            currentIndex = nodeIndex * maxElementsPerNode * bitsPerElement + offset * bitsPerElement;
        }
        /* we're adding to the first empty spot from the beginning of the bucket - this is
         * preferable to adding at the end because we want our getElements method to be fast, and
         * it's okay for addElement to be comparatively slow */
        storage.setElementValue(currentIndex, bitsPerElement, element);
    }
public void addElement(long nodeIndex, long element) {
        if (element > elementMask) {
            throw new IllegalArgumentException("Element " + element + " does not fit in "
                    + bitsPerElement + " bits");
        }
        if (nodeIndex >= numNodes) {
            throw new IllegalArgumentException("Provided nodeIndex  " + nodeIndex
                    + " greater then numNodes " + numNodes);
        }
        if (element == NO_ELEMENT) {
            // we use 0 to indicate an "empty" element, so we have to store ordinal zero here
            nodesWithOrdinalZero.setElementValue(nodeIndex, 1, 1);
            return;
        }
        long bucketStart = nodeIndex * maxElementsPerNode * bitsPerElement;
        long currentIndex;
        int offset = 0;
        do {
            currentIndex = bucketStart + offset * bitsPerElement;
            offset++;
        } while (storage.getElementValue(currentIndex, bitsPerElement, elementMask) != NO_ELEMENT
                && offset < maxElementsPerNode);
        if (storage.getElementValue(currentIndex, bitsPerElement, elementMask) != NO_ELEMENT) {
            // we're full at this index - resize, then figure out the new current index
            resizeStorage();
            currentIndex = nodeIndex * maxElementsPerNode * bitsPerElement + offset * bitsPerElement;
        }
        /* we're adding to the first empty spot from the beginning of the bucket - this is
         * preferable to adding at the end because we want our getElements method to be fast, and
         * it's okay for addElement to be comparatively slow */
        storage.setElementValue(currentIndex, bitsPerElement, element);
    }
public void addElement ( long nodeIndex , long element ) { if ( element > elementMask ) { throw new IllegalArgumentException ( "Element " + element + " does not fit in " + bitsPerElement + " bits" ) ; } if ( nodeIndex >= numNodes ) { throw new IllegalArgumentException ( "Provided nodeIndex  " + nodeIndex + " greater then numNodes " + numNodes ) ; } if ( element == NO_ELEMENT ) { // we use 0 to indicate an "empty" element, so we have to store ordinal zero here nodesWithOrdinalZero . setElementValue ( nodeIndex , 1 , 1 ) ; return ; } long bucketStart = nodeIndex * maxElementsPerNode * bitsPerElement ; long currentIndex ; int offset = 0 ; do { currentIndex = bucketStart + offset * bitsPerElement ; offset ++ ; } while ( storage . getElementValue ( currentIndex , bitsPerElement , elementMask ) != NO_ELEMENT && offset < maxElementsPerNode ) ; if ( storage . getElementValue ( currentIndex , bitsPerElement , elementMask ) != NO_ELEMENT ) { // we're full at this index - resize, then figure out the new current index resizeStorage ( ) ; currentIndex = nodeIndex * maxElementsPerNode * bitsPerElement + offset * bitsPerElement ; } /* we're adding to the first empty spot from the beginning of the bucket - this is
         * preferable to adding at the end because we want our getElements method to be fast, and
         * it's okay for addElement to be comparatively slow */ storage . setElementValue ( currentIndex , bitsPerElement , element ) ; }
This method adds an element at nodeIndex. Note that this does not check for duplicates; if
the element already exists, another instance of it will be added.
This method is not thread-safe - you cannot call this method concurrently with itself or with
{@link #getElements}.

@param nodeIndex the node index
@param element the element to add
This method adds an element at nodeIndex . Note that this does not check for duplicates ; if the element already exists another instance of it will be added . This method is not thread - safe - you cannot call this method concurrently with itself or with { @link #getElements } .