Remove a method almost duplicated in other method
Change-Id: Idc9bd0cb53696f379fe77b7b30683eb977a597ad
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/DiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/DiscreteResources.java
index 6c65122..b6acccc 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/DiscreteResources.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/DiscreteResources.java
@@ -86,15 +86,6 @@
DiscreteResources add(DiscreteResources other);
/**
- * Returns a difference set of this instance and the given resources.
- * Note: This method returns a new instance, not mutate the current intance.
- *
- * @param removed resources
- * @return a new DiscreteResources instance representing a difference set
- */
- DiscreteResources remove(Set<DiscreteResource> removed);
-
- /**
* Returns all of resources this instance holds.
*
* @return all resources
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EmptyDiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EmptyDiscreteResources.java
index 9211576..d7c0f24 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EmptyDiscreteResources.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EmptyDiscreteResources.java
@@ -58,11 +58,6 @@
}
@Override
- public DiscreteResources remove(Set<DiscreteResource> removed) {
- return this;
- }
-
- @Override
public Set<DiscreteResource> values() {
return ImmutableSet.of();
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EncodableDiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EncodableDiscreteResources.java
index 99352ac..25ec5a7 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EncodableDiscreteResources.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/EncodableDiscreteResources.java
@@ -108,11 +108,6 @@
}
@Override
- public DiscreteResources remove(Set<DiscreteResource> removed) {
- return of(parent, Sets.difference(values(), removed));
- }
-
- @Override
public Set<DiscreteResource> values() {
return values.values().stream()
.flatMap(x -> x.values(parent.id()).stream())
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java
index d35a477..79eb13d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/GenericDiscreteResources.java
@@ -79,12 +79,6 @@
return new GenericDiscreteResources(newValues);
}
- // returns a new instance, not mutate the current instance
- @Override
- public DiscreteResources remove(Set<DiscreteResource> removed) {
- return of(Sets.difference(this.values, removed));
- }
-
@Override
public Set<DiscreteResource> values() {
// breaks immutability, but intentionally returns the field
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/TransactionalDiscreteResourceSubStore.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/TransactionalDiscreteResourceSubStore.java
index d2cecb0..1f51f7b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/TransactionalDiscreteResourceSubStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/TransactionalDiscreteResourceSubStore.java
@@ -102,7 +102,8 @@
return true;
}
- DiscreteResources newValues = oldValues.remove(values);
+ DiscreteResources requested = DiscreteResources.of(values);
+ DiscreteResources newValues = oldValues.difference(requested);
return childMap.replace(key, oldValues, newValues);
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java
index 1959a59..0bd1fca 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/resource/impl/UnifiedDiscreteResources.java
@@ -88,11 +88,6 @@
}
@Override
- public DiscreteResources remove(Set<DiscreteResource> removed) {
- return of(Sets.difference(values(), removed));
- }
-
- @Override
public Set<DiscreteResource> values() {
return Stream.concat(encodables.values().stream(), generics.values().stream())
.collect(Collectors.toCollection(LinkedHashSet::new));