class InetAddressTable {

    public boolean contains(InetAddress address) {
        if (this.addresses.contains(address)) {
            return true;
        }

        if (this.blocks.isEmpty()) {
            return false;
        }

        //TODO(mmarquez): we need to check if this is thread safe
        InetAddressBlock[] bs = this.blocks.toArray(new InetAddressBlock[0]);
        for (InetAddressBlock mask : bs) {
            if (mask.contains(address)) {
                return true;
            }
        }

        return false;
    }

}