Committed by
Gerrit Code Review
Use specific types instead of using type parameters
Change-Id: I39dc222deb533c7201df1961f5ab2fd589fac39e
Showing
1 changed file
with
8 additions
and
10 deletions
... | @@ -472,12 +472,11 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -472,12 +472,11 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
472 | * @param map map holding multiple values for a key | 472 | * @param map map holding multiple values for a key |
473 | * @param key key specifying values | 473 | * @param key key specifying values |
474 | * @param values values to be appended | 474 | * @param values values to be appended |
475 | - * @param <K> type of the key | ||
476 | - * @param <V> type of the element of the list | ||
477 | * @return true if the operation succeeds, false otherwise. | 475 | * @return true if the operation succeeds, false otherwise. |
478 | */ | 476 | */ |
479 | - private <K, V> boolean appendValues(TransactionalMap<K, Set<V>> map, K key, List<V> values) { | 477 | + private boolean appendValues(TransactionalMap<DiscreteResource, Set<Resource>> map, |
480 | - Set<V> oldValues = map.putIfAbsent(key, new LinkedHashSet<>(values)); | 478 | + DiscreteResource key, List<Resource> values) { |
479 | + Set<Resource> oldValues = map.putIfAbsent(key, new LinkedHashSet<>(values)); | ||
481 | if (oldValues == null) { | 480 | if (oldValues == null) { |
482 | return true; | 481 | return true; |
483 | } | 482 | } |
... | @@ -487,7 +486,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -487,7 +486,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
487 | return true; | 486 | return true; |
488 | } | 487 | } |
489 | 488 | ||
490 | - LinkedHashSet<V> newValues = new LinkedHashSet<>(oldValues); | 489 | + LinkedHashSet<Resource> newValues = new LinkedHashSet<>(oldValues); |
491 | newValues.addAll(values); | 490 | newValues.addAll(values); |
492 | return map.replace(key, oldValues, newValues); | 491 | return map.replace(key, oldValues, newValues); |
493 | } | 492 | } |
... | @@ -499,12 +498,11 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -499,12 +498,11 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
499 | * @param map map holding multiple values for a key | 498 | * @param map map holding multiple values for a key |
500 | * @param key key specifying values | 499 | * @param key key specifying values |
501 | * @param values values to be removed | 500 | * @param values values to be removed |
502 | - * @param <K> type of the key | ||
503 | - * @param <V> type of the element of the list | ||
504 | * @return true if the operation succeeds, false otherwise | 501 | * @return true if the operation succeeds, false otherwise |
505 | */ | 502 | */ |
506 | - private <K, V> boolean removeValues(TransactionalMap<K, Set<V>> map, K key, List<? extends V> values) { | 503 | + private boolean removeValues(TransactionalMap<DiscreteResource, Set<Resource>> map, |
507 | - Set<V> oldValues = map.putIfAbsent(key, new LinkedHashSet<>()); | 504 | + DiscreteResource key, List<Resource> values) { |
505 | + Set<Resource> oldValues = map.putIfAbsent(key, new LinkedHashSet<>()); | ||
508 | if (oldValues == null) { | 506 | if (oldValues == null) { |
509 | log.trace("No-Op removing values. key {} did not exist", key); | 507 | log.trace("No-Op removing values. key {} did not exist", key); |
510 | return true; | 508 | return true; |
... | @@ -516,7 +514,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour | ... | @@ -516,7 +514,7 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour |
516 | return true; | 514 | return true; |
517 | } | 515 | } |
518 | 516 | ||
519 | - LinkedHashSet<V> newValues = new LinkedHashSet<>(oldValues); | 517 | + LinkedHashSet<Resource> newValues = new LinkedHashSet<>(oldValues); |
520 | newValues.removeAll(values); | 518 | newValues.removeAll(values); |
521 | return map.replace(key, oldValues, newValues); | 519 | return map.replace(key, oldValues, newValues); |
522 | } | 520 | } | ... | ... |
-
Please register or login to post a comment