public boolean removeNetKey(@NonNull final NetworkKey networkKey) throws IllegalArgumentException {
        if (!isKeyInUse(networkKey)) {
            if (netKeys.remove(networkKey)) {
                notifyNetKeyDeleted(networkKey);
                return true;
            } else {
                throw new IllegalArgumentException("Key does not exist.");
            }
        }
        throw new IllegalArgumentException("Unable to delete a network key that's already in use.");
    }
Removes a network key from the network key list

@param networkKey key to be removed
@throws IllegalArgumentException if the key is in use or if it does not exist in the list of keys
mesh/src/main/java/no/nordicsemi/android/mesh/BaseMeshNetwork.java