Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Simplify code using Java 8 features
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
entityownership
/
CandidateListChangeListener.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java
b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java
index 005de8729ee0b484c92143b28c6d8c9162404f56..a7be8c50d2cf949244143d8e5fad4f0569d45c90 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/CandidateListChangeListener.java
@@
-93,11
+93,7
@@
class CandidateListChangeListener implements DOMDataTreeChangeListener {
}
private Collection<String> addToCurrentCandidates(YangInstanceIdentifier entityId, String newCandidate) {
}
private Collection<String> addToCurrentCandidates(YangInstanceIdentifier entityId, String newCandidate) {
- Collection<String> candidates = currentCandidates.get(entityId);
- if (candidates == null) {
- candidates = new LinkedHashSet<>();
- currentCandidates.put(entityId, candidates);
- }
+ Collection<String> candidates = currentCandidates.computeIfAbsent(entityId, k -> new LinkedHashSet<>());
candidates.add(newCandidate);
return candidates;
candidates.add(newCandidate);
return candidates;