public void allowOnlyTheseAuthorizedKeysToRead(HQKeys authorizedKeys) { HQKeys keys = getAuthorizedToReadKeys(); for (int i = 0; i < keys.size(); ++i) { HQKey oldKey = keys.get(i); if (!authorizedKeys.containsKey(oldKey.getPublicKey())) keys.remove(i); } setAuthorizedToReadKeys(keys); }
public void addAuthorizedToReadKeys(HQKeys keysToAdd) { HQKeys keys = getAuthorizedToReadKeys(); for (int i = 0; i < keysToAdd.size(); ++i) { HQKey keyToAdd = keysToAdd.get(i); if (!keys.containsKey(keyToAdd.getPublicKey())) { keys.add(keyToAdd); } } setAuthorizedToReadKeys(keys); }