Use dianmond operator
Change-Id: I551dd9443b10ef17832f74a554486b7605e9866a
diff --git a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java
index 41cf8ac..3dc312d 100644
--- a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultEdgeGroupHandler.java
@@ -69,7 +69,7 @@
Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(neighbors);
log.trace("createGroupsAtEdgeRouter: The size of neighbor powerset "
+ "for sw {} is {}", deviceId, powerSet.size());
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : powerSet) {
if (combo.isEmpty()) {
continue;
@@ -148,7 +148,7 @@
Set<DeviceId> updatedNeighbors) {
Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors);
- Set<DeviceId> tmp = new HashSet<DeviceId>();
+ Set<DeviceId> tmp = new HashSet<>();
tmp.addAll(updatedNeighbors);
tmp.remove(impactedNeighbor);
Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp);
@@ -156,7 +156,7 @@
// Compute the impacted neighbor sets
powerSet.removeAll(tmpPowerSet);
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : powerSet) {
if (combo.isEmpty()) {
continue;
diff --git a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
index a43a0f0..3ff0e35 100644
--- a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java
@@ -371,7 +371,7 @@
if (devicePortMap.get(neighborId) != null) {
devicePortMap.get(neighborId).add(portToNeighbor);
} else {
- Set<PortNumber> ports = new HashSet<PortNumber>();
+ Set<PortNumber> ports = new HashSet<>();
ports.add(portToNeighbor);
devicePortMap.put(neighborId, ports);
}
@@ -383,8 +383,8 @@
}
protected Set<Set<DeviceId>> getPowerSetOfNeighbors(Set<DeviceId> neighbors) {
- List<DeviceId> list = new ArrayList<DeviceId>(neighbors);
- Set<Set<DeviceId>> sets = new HashSet<Set<DeviceId>>();
+ List<DeviceId> list = new ArrayList<>(neighbors);
+ Set<Set<DeviceId>> sets = new HashSet<>();
// get the number of elements in the neighbors
int elements = list.size();
// the number of members of a power set is 2^n
@@ -394,7 +394,7 @@
// run a binary counter for the number of power elements
// NOTE: Exclude empty set
for (long i = 1; i < powerElements; i++) {
- Set<DeviceId> neighborSubSet = new HashSet<DeviceId>();
+ Set<DeviceId> neighborSubSet = new HashSet<>();
for (int j = 0; j < elements; j++) {
if ((i >> j) % 2 == 1) {
neighborSubSet.add(list.get(j));
@@ -411,7 +411,7 @@
protected List<Integer> getSegmentIdsTobePairedWithNeighborSet(Set<DeviceId> neighbors) {
- List<Integer> nsSegmentIds = new ArrayList<Integer>();
+ List<Integer> nsSegmentIds = new ArrayList<>();
// Always pair up with no edge label
// If (neighbors.size() == 1) {
diff --git a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java
index e12426c..3cb73ab 100644
--- a/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java
+++ b/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultTransitGroupHandler.java
@@ -63,7 +63,7 @@
sets = filterEdgeRouterOnlyPairings(sets);
log.debug("createGroupsAtTransitRouter: The size of neighbor powerset "
+ "for sw {} is {}", deviceId, sets.size());
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : sets) {
if (combo.isEmpty()) {
continue;
@@ -137,7 +137,7 @@
Set<DeviceId> updatedNeighbors) {
Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors);
- Set<DeviceId> tmp = new HashSet<DeviceId>();
+ Set<DeviceId> tmp = new HashSet<>();
tmp.addAll(updatedNeighbors);
tmp.remove(impactedNeighbor);
Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp);
@@ -146,7 +146,7 @@
powerSet.removeAll(tmpPowerSet);
powerSet = filterEdgeRouterOnlyPairings(powerSet);
- Set<NeighborSet> nsSet = new HashSet<NeighborSet>();
+ Set<NeighborSet> nsSet = new HashSet<>();
for (Set<DeviceId> combo : powerSet) {
if (combo.isEmpty()) {
continue;
@@ -163,7 +163,7 @@
}
private Set<Set<DeviceId>> filterEdgeRouterOnlyPairings(Set<Set<DeviceId>> sets) {
- Set<Set<DeviceId>> fiteredSets = new HashSet<Set<DeviceId>>();
+ Set<Set<DeviceId>> fiteredSets = new HashSet<>();
for (Set<DeviceId> deviceSubSet : sets) {
if (deviceSubSet.size() > 1) {
boolean avoidEdgeRouterPairing = true;
diff --git a/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java b/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java
index 7ada322..44715d2 100644
--- a/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java
+++ b/src/main/java/org/onosproject/segmentrouting/grouphandler/NeighborSet.java
@@ -44,7 +44,7 @@
public NeighborSet(Set<DeviceId> neighbors) {
checkNotNull(neighbors);
this.edgeLabel = NO_EDGE_LABEL;
- this.neighbors = new HashSet<DeviceId>();
+ this.neighbors = new HashSet<>();
this.neighbors.addAll(neighbors);
}
@@ -57,7 +57,7 @@
public NeighborSet(Set<DeviceId> neighbors, int edgeLabel) {
checkNotNull(neighbors);
this.edgeLabel = edgeLabel;
- this.neighbors = new HashSet<DeviceId>();
+ this.neighbors = new HashSet<>();
this.neighbors.addAll(neighbors);
}
@@ -66,7 +66,7 @@
*/
public NeighborSet() {
this.edgeLabel = NO_EDGE_LABEL;
- this.neighbors = new HashSet<DeviceId>();
+ this.neighbors = new HashSet<>();
}
/**