base/common/src/main/com/thesett/common/util/doublemaps/HashMapXY.java
public E put(Long x, Long y, E value)
    {
        // Check that the value is not null as this data structure does not allow nulls
        if (value == null)
        {
            throw new IllegalArgumentException("Null values not allowed in HashMapXY data structure.");
        }

        // Extract the region containing the coordinates from the hash table
        Bucket<E> region = (Bucket<E>) regions.get(new Coordinates(div(x, bucketSize), div(y, bucketSize)));

        // Check if the region does not exist yet and create it if so
        if (region == null)
        {
            region = new Bucket<E>(bucketSize);
            regions.put(new Coordinates(div(x, bucketSize), div(y, bucketSize)), region);
        }

        // Take a reference to the old value if there is one
        E old = region.array[mod(x, bucketSize)][mod(y, bucketSize)];

        // Insert the new value into the bucket
        region.array[mod(x, bucketSize)][mod(y, bucketSize)] = value;

        // Increment the bucket and whole data structure item counts to reflect the true size
        size++;
        region.itemCount++;

        // Return the replaced value
        return old;
    }
public E put(Long x, Long y, E value)
    {
        // Check that the value is not null as this data structure does not allow nulls
        if (value == null)
        {
            throw new IllegalArgumentException("Null values not allowed in HashMapXY data structure.");
        }

        // Extract the region containing the coordinates from the hash table
        Bucket<E> region = (Bucket<E>) regions.get(new Coordinates(div(x, bucketSize), div(y, bucketSize)));

        // Check if the region does not exist yet and create it if so
        if (region == null)
        {
            region = new Bucket<E>(bucketSize);
            regions.put(new Coordinates(div(x, bucketSize), div(y, bucketSize)), region);
        }

        // Take a reference to the old value if there is one
        E old = region.array[mod(x, bucketSize)][mod(y, bucketSize)];

        // Insert the new value into the bucket
        region.array[mod(x, bucketSize)][mod(y, bucketSize)] = value;

        // Increment the bucket and whole data structure item counts to reflect the true size
        size++;
        region.itemCount++;

        // Return the replaced value
        return old;
    }
Associates the specified value with the specified coordinate in this map (optional operation). If the map
previously contained a mapping for this coordinate, the old value is replaced.

@param  x     The x coordinate.
@param  y     The y coordinate.
@param  value Value to be associated with the specified coordinate.

@return Previous value associated with specified coordinate, or <tt>null</tt> if there was no mapping for
coordinate.

@throws NullPointerException If the specified value is <tt>null</tt>.