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;
}
};
- public static final Function<Identity, Collection<Map.Entry<String, String>>> TO_PROPERTIES = new Function<Identity, Collection<Entry<String, String>>>() {
+ public static final Function<Identity, Map<String, String>> TO_PROPERTIES = new Function<Identity, Map<String, String>>() {
@Override
- public Collection<Entry<String, String>> apply(Identity input) {
- return (input == null) ? Collections.<Map.Entry<String, String>>emptySet() : input.getProperties().entrySet();
+ public Map<String, String> apply(Identity input) {
+ return (input == null) ? Collections.<String, String>emptyMap() : input.getProperties();
}
};
}
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<Identity> containedIn(final Map<String, Identity> identities) {