public void put(final E element) {

        int index = 0;
        boolean added = false;

        while (!added) {

            // #1
            // To set or not to set...
            if (array.getElement(index) == null) {
                array.setElement(index, element);
                added = true;
                currentSize++;
                break;
                // NO break ! See #3
            }

            // #2
            // Choose between left and right positions, increasing the index
            if (array.getElement(index).compareTo(element) > 0) {
                index = getLeftChildIndex(index);
            } else {
                index = getRightChildIndex(index);
            }

            // #3
            // If there is no break in #1 the capacity is increased for the next
            // layer due to #2 and new element can be safely added
            if (index >= array.getSize()) {
                addCapacityLayer();
            }
        }

        rebalance();
    }