From: David ‘Bombe’ Roden Date: Wed, 17 Sep 2014 18:35:33 +0000 (+0200) Subject: Small optimization when an identity is removed. X-Git-Tag: 0.9-rc1^2~3^2~118 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f2eaa4ab7f0055a704425f2159efaa5be46b7c5e;p=Sone.git Small optimization when an identity is removed. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 6d90516..7d38ed9 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1952,19 +1952,14 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, OwnIdentity ownIdentity = identityRemovedEvent.ownIdentity(); Identity identity = identityRemovedEvent.identity(); trustedIdentities.remove(ownIdentity, identity); - boolean foundIdentity = false; for (Entry> trustedIdentity : trustedIdentities.asMap().entrySet()) { if (trustedIdentity.getKey().equals(ownIdentity)) { continue; } if (trustedIdentity.getValue().contains(identity)) { - foundIdentity = true; + return; } } - if (foundIdentity) { - /* some local identity still trusts this identity, don’t remove. */ - return; - } Optional sone = getSone(identity.getId()); if (!sone.isPresent()) { /* TODO - we don’t have the Sone anymore. should this happen? */