From c6c5a9f17eaab1656455f4a1b582fc411aab5eb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 12 Nov 2013 06:30:20 +0100 Subject: [PATCH] Convert an Identity into a Map, not a Collection of Entrys. --- src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java | 7 +++---- .../net/pterodactylus/sone/freenet/wot/IdentityChangeDetector.java | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java b/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java index 523a42b..d0cafc5 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/Identity.java @@ -20,7 +20,6 @@ package net.pterodactylus.sone.freenet.wot; import java.util.Collection; import java.util.Collections; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import com.google.common.base.Function; @@ -41,10 +40,10 @@ public interface Identity { } }; - public static final Function>> TO_PROPERTIES = new Function>>() { + public static final Function> TO_PROPERTIES = new Function>() { @Override - public Collection> apply(Identity input) { - return (input == null) ? Collections.>emptySet() : input.getProperties().entrySet(); + public Map apply(Identity input) { + return (input == null) ? Collections.emptyMap() : input.getProperties(); } }; diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityChangeDetector.java b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityChangeDetector.java index 3a0cb4b..a8cb62b 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityChangeDetector.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityChangeDetector.java @@ -127,15 +127,15 @@ public class IdentityChangeDetector { } private static boolean identityHasNewProperties(Identity oldIdentity, Identity newIdentity) { - return from(TO_PROPERTIES.apply(newIdentity)).anyMatch(notAPropertyOf(oldIdentity)); + return from(TO_PROPERTIES.apply(newIdentity).entrySet()).anyMatch(notAPropertyOf(oldIdentity)); } private static boolean identityHasRemovedProperties(Identity oldIdentity, Identity newIdentity) { - return from(TO_PROPERTIES.apply(oldIdentity)).anyMatch(notAPropertyOf(newIdentity)); + return from(TO_PROPERTIES.apply(oldIdentity).entrySet()).anyMatch(notAPropertyOf(newIdentity)); } private static boolean identityHasChangedProperties(Identity oldIdentity, Identity newIdentity) { - return from(TO_PROPERTIES.apply(oldIdentity)).anyMatch(hasADifferentValueThanIn(newIdentity)); + return from(TO_PROPERTIES.apply(oldIdentity).entrySet()).anyMatch(hasADifferentValueThanIn(newIdentity)); } private static Predicate containedIn(final Map identities) { -- 2.7.4