Sho SHIMIZU
Committed by Gerrit Code Review

Use dianmond operator

Change-Id: I551dd9443b10ef17832f74a554486b7605e9866a
Showing 18 changed files with 48 additions and 52 deletions
...@@ -234,7 +234,7 @@ public class DistributedAclStore extends AbstractStore implements AclStore { ...@@ -234,7 +234,7 @@ public class DistributedAclStore extends AbstractStore implements AclStore {
234 ruleToDevice.computeIf(ruleId, 234 ruleToDevice.computeIf(ruleId,
235 deviceIdSet -> (deviceIdSet == null || !deviceIdSet.contains(deviceId)), 235 deviceIdSet -> (deviceIdSet == null || !deviceIdSet.contains(deviceId)),
236 (id, deviceIdSet) -> { 236 (id, deviceIdSet) -> {
237 - Set<DeviceId> newSet = new HashSet<DeviceId>(); 237 + Set<DeviceId> newSet = new HashSet<>();
238 if (deviceIdSet != null) { 238 if (deviceIdSet != null) {
239 newSet.addAll(deviceIdSet); 239 newSet.addAll(deviceIdSet);
240 } 240 }
......
...@@ -34,8 +34,8 @@ public class OpticalNetworkConfig { ...@@ -34,8 +34,8 @@ public class OpticalNetworkConfig {
34 private List<OpticalLinkDescription> opticalLinks; 34 private List<OpticalLinkDescription> opticalLinks;
35 35
36 public OpticalNetworkConfig() { 36 public OpticalNetworkConfig() {
37 - opticalSwitches = new ArrayList<OpticalSwitchDescription>(); 37 + opticalSwitches = new ArrayList<>();
38 - opticalLinks = new ArrayList<OpticalLinkDescription>(); 38 + opticalLinks = new ArrayList<>();
39 } 39 }
40 40
41 public List<OpticalSwitchDescription> getOpticalSwitches() { 41 public List<OpticalSwitchDescription> getOpticalSwitches() {
......
...@@ -887,7 +887,7 @@ public class IntentSynchronizer implements FibListener, IntentRequestListener { ...@@ -887,7 +887,7 @@ public class IntentSynchronizer implements FibListener, IntentRequestListener {
887 checkNotNull(dstMacAddress); 887 checkNotNull(dstMacAddress);
888 checkNotNull(srcConnectPoint); 888 checkNotNull(srcConnectPoint);
889 889
890 - Set<ConnectPoint> ingressPoints = new HashSet<ConnectPoint>(); 890 + Set<ConnectPoint> ingressPoints = new HashSet<>();
891 ingressPoints.add(srcConnectPoint); 891 ingressPoints.add(srcConnectPoint);
892 IpPrefix dstIpPrefix = dstIpAddress.toIpPrefix(); 892 IpPrefix dstIpPrefix = dstIpAddress.toIpPrefix();
893 893
......
...@@ -48,7 +48,7 @@ public class DeviceConfiguration implements DeviceProperties { ...@@ -48,7 +48,7 @@ public class DeviceConfiguration implements DeviceProperties {
48 48
49 private static final Logger log = LoggerFactory 49 private static final Logger log = LoggerFactory
50 .getLogger(DeviceConfiguration.class); 50 .getLogger(DeviceConfiguration.class);
51 - private final List<Integer> allSegmentIds = new ArrayList<Integer>(); 51 + private final List<Integer> allSegmentIds = new ArrayList<>();
52 private final HashMap<DeviceId, SegmentRouterInfo> deviceConfigMap = new HashMap<>(); 52 private final HashMap<DeviceId, SegmentRouterInfo> deviceConfigMap = new HashMap<>();
53 private final NetworkConfigManager configService; 53 private final NetworkConfigManager configService;
54 54
...@@ -88,7 +88,7 @@ public class DeviceConfiguration implements DeviceProperties { ...@@ -88,7 +88,7 @@ public class DeviceConfiguration implements DeviceProperties {
88 info.ip = prefix.address(); 88 info.ip = prefix.address();
89 info.isEdge = ((SegmentRouterConfig) cfg).isEdgeRouter(); 89 info.isEdge = ((SegmentRouterConfig) cfg).isEdgeRouter();
90 info.subnets = new HashMap<>(); 90 info.subnets = new HashMap<>();
91 - info.gatewayIps = new HashMap<PortNumber, Ip4Address>(); 91 + info.gatewayIps = new HashMap<>();
92 for (Subnet s: ((SegmentRouterConfig) cfg).getSubnets()) { 92 for (Subnet s: ((SegmentRouterConfig) cfg).getSubnets()) {
93 info.subnets.put(PortNumber.portNumber(s.getPortNo()), 93 info.subnets.put(PortNumber.portNumber(s.getPortNo()),
94 Ip4Prefix.valueOf(s.getSubnetIp())); 94 Ip4Prefix.valueOf(s.getSubnetIp()));
......
...@@ -109,7 +109,7 @@ public class ECMPShortestPathGraph { ...@@ -109,7 +109,7 @@ public class ECMPShortestPathGraph {
109 ArrayList<DeviceId> distanceSwArray = distanceDeviceMap 109 ArrayList<DeviceId> distanceSwArray = distanceDeviceMap
110 .get(currDistance + 1); 110 .get(currDistance + 1);
111 if (distanceSwArray == null) { 111 if (distanceSwArray == null) {
112 - distanceSwArray = new ArrayList<DeviceId>(); 112 + distanceSwArray = new ArrayList<>();
113 distanceSwArray.add(reachedDevice); 113 distanceSwArray.add(reachedDevice);
114 distanceDeviceMap.put(currDistance + 1, distanceSwArray); 114 distanceDeviceMap.put(currDistance + 1, distanceSwArray);
115 } else { 115 } else {
...@@ -120,7 +120,7 @@ public class ECMPShortestPathGraph { ...@@ -120,7 +120,7 @@ public class ECMPShortestPathGraph {
120 ArrayList<Link> upstreamLinkArray = 120 ArrayList<Link> upstreamLinkArray =
121 upstreamLinks.get(reachedDevice); 121 upstreamLinks.get(reachedDevice);
122 if (upstreamLinkArray == null) { 122 if (upstreamLinkArray == null) {
123 - upstreamLinkArray = new ArrayList<Link>(); 123 + upstreamLinkArray = new ArrayList<>();
124 upstreamLinkArray.add(copyDefaultLink(link)); 124 upstreamLinkArray.add(copyDefaultLink(link));
125 //upstreamLinkArray.add(link); 125 //upstreamLinkArray.add(link);
126 upstreamLinks.put(reachedDevice, upstreamLinkArray); 126 upstreamLinks.put(reachedDevice, upstreamLinkArray);
...@@ -183,7 +183,7 @@ public class ECMPShortestPathGraph { ...@@ -183,7 +183,7 @@ public class ECMPShortestPathGraph {
183 ArrayList<DeviceId> distanceSwArray = distanceDeviceMap 183 ArrayList<DeviceId> distanceSwArray = distanceDeviceMap
184 .get(currDistance + 1); 184 .get(currDistance + 1);
185 if (distanceSwArray == null) { 185 if (distanceSwArray == null) {
186 - distanceSwArray = new ArrayList<DeviceId>(); 186 + distanceSwArray = new ArrayList<>();
187 distanceSwArray.add(reachedDevice); 187 distanceSwArray.add(reachedDevice);
188 distanceDeviceMap.put(currDistance + 1, distanceSwArray); 188 distanceDeviceMap.put(currDistance + 1, distanceSwArray);
189 } else { 189 } else {
...@@ -194,7 +194,7 @@ public class ECMPShortestPathGraph { ...@@ -194,7 +194,7 @@ public class ECMPShortestPathGraph {
194 ArrayList<Link> upstreamLinkArray = 194 ArrayList<Link> upstreamLinkArray =
195 upstreamLinks.get(reachedDevice); 195 upstreamLinks.get(reachedDevice);
196 if (upstreamLinkArray == null) { 196 if (upstreamLinkArray == null) {
197 - upstreamLinkArray = new ArrayList<Link>(); 197 + upstreamLinkArray = new ArrayList<>();
198 upstreamLinkArray.add(copyDefaultLink(link)); 198 upstreamLinkArray.add(copyDefaultLink(link));
199 upstreamLinks.put(reachedDevice, upstreamLinkArray); 199 upstreamLinks.put(reachedDevice, upstreamLinkArray);
200 } else { 200 } else {
...@@ -234,7 +234,7 @@ public class ECMPShortestPathGraph { ...@@ -234,7 +234,7 @@ public class ECMPShortestPathGraph {
234 for (Link upstreamLink : upstreamLinks.get(dstDeviceDeviceId)) { 234 for (Link upstreamLink : upstreamLinks.get(dstDeviceDeviceId)) {
235 /* Deep clone the path object */ 235 /* Deep clone the path object */
236 Path sofarPath; 236 Path sofarPath;
237 - ArrayList<Link> sofarLinks = new ArrayList<Link>(); 237 + ArrayList<Link> sofarLinks = new ArrayList<>();
238 if (path != null && !path.links().isEmpty()) { 238 if (path != null && !path.links().isEmpty()) {
239 sofarLinks.addAll(path.links()); 239 sofarLinks.addAll(path.links());
240 } 240 }
...@@ -288,12 +288,10 @@ public class ECMPShortestPathGraph { ...@@ -288,12 +288,10 @@ public class ECMPShortestPathGraph {
288 public HashMap<Integer, HashMap<DeviceId, 288 public HashMap<Integer, HashMap<DeviceId,
289 ArrayList<Path>>> getCompleteLearnedDeviceesAndPaths() { 289 ArrayList<Path>>> getCompleteLearnedDeviceesAndPaths() {
290 290
291 - HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>> pathGraph = new 291 + HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>> pathGraph = new HashMap<>();
292 - HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>>();
293 292
294 for (Integer itrIndx : distanceDeviceMap.keySet()) { 293 for (Integer itrIndx : distanceDeviceMap.keySet()) {
295 - HashMap<DeviceId, ArrayList<Path>> swMap = new 294 + HashMap<DeviceId, ArrayList<Path>> swMap = new HashMap<>();
296 - HashMap<DeviceId, ArrayList<Path>>();
297 for (DeviceId sw : distanceDeviceMap.get(itrIndx)) { 295 for (DeviceId sw : distanceDeviceMap.get(itrIndx)) {
298 swMap.put(sw, getECMPPaths(sw)); 296 swMap.put(sw, getECMPPaths(sw));
299 } 297 }
...@@ -314,12 +312,10 @@ public class ECMPShortestPathGraph { ...@@ -314,12 +312,10 @@ public class ECMPShortestPathGraph {
314 public HashMap<Integer, HashMap<DeviceId, 312 public HashMap<Integer, HashMap<DeviceId,
315 ArrayList<ArrayList<DeviceId>>>> getAllLearnedSwitchesAndVia() { 313 ArrayList<ArrayList<DeviceId>>>> getAllLearnedSwitchesAndVia() {
316 314
317 - HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>> deviceViaMap = 315 + HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>> deviceViaMap = new HashMap<>();
318 - new HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>>();
319 316
320 for (Integer itrIndx : distanceDeviceMap.keySet()) { 317 for (Integer itrIndx : distanceDeviceMap.keySet()) {
321 - HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>> swMap = 318 + HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>> swMap = new HashMap<>();
322 - new HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>();
323 319
324 for (DeviceId sw : distanceDeviceMap.get(itrIndx)) { 320 for (DeviceId sw : distanceDeviceMap.get(itrIndx)) {
325 ArrayList<ArrayList<DeviceId>> swViaArray = new ArrayList<>(); 321 ArrayList<ArrayList<DeviceId>> swViaArray = new ArrayList<>();
......
...@@ -50,7 +50,7 @@ public class IpHandler { ...@@ -50,7 +50,7 @@ public class IpHandler {
50 public IpHandler(SegmentRoutingManager srManager) { 50 public IpHandler(SegmentRoutingManager srManager) {
51 this.srManager = srManager; 51 this.srManager = srManager;
52 this.config = checkNotNull(srManager.deviceConfiguration); 52 this.config = checkNotNull(srManager.deviceConfiguration);
53 - ipPacketQueue = new ConcurrentHashMap<Ip4Address, ConcurrentLinkedQueue<IPv4>>(); 53 + ipPacketQueue = new ConcurrentHashMap<>();
54 } 54 }
55 55
56 /** 56 /**
...@@ -104,7 +104,7 @@ public class IpHandler { ...@@ -104,7 +104,7 @@ public class IpHandler {
104 Ip4Address destIpAddress = Ip4Address.valueOf(ipPacket.getDestinationAddress()); 104 Ip4Address destIpAddress = Ip4Address.valueOf(ipPacket.getDestinationAddress());
105 105
106 if (ipPacketQueue.get(destIpAddress) == null) { 106 if (ipPacketQueue.get(destIpAddress) == null) {
107 - ConcurrentLinkedQueue<IPv4> queue = new ConcurrentLinkedQueue<IPv4>(); 107 + ConcurrentLinkedQueue<IPv4> queue = new ConcurrentLinkedQueue<>();
108 queue.add(ipPacket); 108 queue.add(ipPacket);
109 ipPacketQueue.put(destIpAddress, queue); 109 ipPacketQueue.put(destIpAddress, queue);
110 } else { 110 } else {
......
...@@ -221,7 +221,7 @@ public class RoutingRulePopulator { ...@@ -221,7 +221,7 @@ public class RoutingRulePopulator {
221 Set<DeviceId> nextHops) { 221 Set<DeviceId> nextHops) {
222 222
223 TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder(); 223 TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
224 - List<ForwardingObjective.Builder> fwdObjBuilders = new ArrayList<ForwardingObjective.Builder>(); 224 + List<ForwardingObjective.Builder> fwdObjBuilders = new ArrayList<>();
225 225
226 // TODO Handle the case of Bos == false 226 // TODO Handle the case of Bos == false
227 sbuilder.matchMplsLabel(MplsLabel.mplsLabel(config.getSegmentId(destSwId))); 227 sbuilder.matchMplsLabel(MplsLabel.mplsLabel(config.getSegmentId(destSwId)));
......
...@@ -69,7 +69,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler { ...@@ -69,7 +69,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler {
69 Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(neighbors); 69 Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(neighbors);
70 log.trace("createGroupsAtEdgeRouter: The size of neighbor powerset " 70 log.trace("createGroupsAtEdgeRouter: The size of neighbor powerset "
71 + "for sw {} is {}", deviceId, powerSet.size()); 71 + "for sw {} is {}", deviceId, powerSet.size());
72 - Set<NeighborSet> nsSet = new HashSet<NeighborSet>(); 72 + Set<NeighborSet> nsSet = new HashSet<>();
73 for (Set<DeviceId> combo : powerSet) { 73 for (Set<DeviceId> combo : powerSet) {
74 if (combo.isEmpty()) { 74 if (combo.isEmpty()) {
75 continue; 75 continue;
...@@ -148,7 +148,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler { ...@@ -148,7 +148,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler {
148 Set<DeviceId> updatedNeighbors) { 148 Set<DeviceId> updatedNeighbors) {
149 Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors); 149 Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors);
150 150
151 - Set<DeviceId> tmp = new HashSet<DeviceId>(); 151 + Set<DeviceId> tmp = new HashSet<>();
152 tmp.addAll(updatedNeighbors); 152 tmp.addAll(updatedNeighbors);
153 tmp.remove(impactedNeighbor); 153 tmp.remove(impactedNeighbor);
154 Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp); 154 Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp);
...@@ -156,7 +156,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler { ...@@ -156,7 +156,7 @@ public class DefaultEdgeGroupHandler extends DefaultGroupHandler {
156 // Compute the impacted neighbor sets 156 // Compute the impacted neighbor sets
157 powerSet.removeAll(tmpPowerSet); 157 powerSet.removeAll(tmpPowerSet);
158 158
159 - Set<NeighborSet> nsSet = new HashSet<NeighborSet>(); 159 + Set<NeighborSet> nsSet = new HashSet<>();
160 for (Set<DeviceId> combo : powerSet) { 160 for (Set<DeviceId> combo : powerSet) {
161 if (combo.isEmpty()) { 161 if (combo.isEmpty()) {
162 continue; 162 continue;
......
...@@ -371,7 +371,7 @@ public class DefaultGroupHandler { ...@@ -371,7 +371,7 @@ public class DefaultGroupHandler {
371 if (devicePortMap.get(neighborId) != null) { 371 if (devicePortMap.get(neighborId) != null) {
372 devicePortMap.get(neighborId).add(portToNeighbor); 372 devicePortMap.get(neighborId).add(portToNeighbor);
373 } else { 373 } else {
374 - Set<PortNumber> ports = new HashSet<PortNumber>(); 374 + Set<PortNumber> ports = new HashSet<>();
375 ports.add(portToNeighbor); 375 ports.add(portToNeighbor);
376 devicePortMap.put(neighborId, ports); 376 devicePortMap.put(neighborId, ports);
377 } 377 }
...@@ -383,8 +383,8 @@ public class DefaultGroupHandler { ...@@ -383,8 +383,8 @@ public class DefaultGroupHandler {
383 } 383 }
384 384
385 protected Set<Set<DeviceId>> getPowerSetOfNeighbors(Set<DeviceId> neighbors) { 385 protected Set<Set<DeviceId>> getPowerSetOfNeighbors(Set<DeviceId> neighbors) {
386 - List<DeviceId> list = new ArrayList<DeviceId>(neighbors); 386 + List<DeviceId> list = new ArrayList<>(neighbors);
387 - Set<Set<DeviceId>> sets = new HashSet<Set<DeviceId>>(); 387 + Set<Set<DeviceId>> sets = new HashSet<>();
388 // get the number of elements in the neighbors 388 // get the number of elements in the neighbors
389 int elements = list.size(); 389 int elements = list.size();
390 // the number of members of a power set is 2^n 390 // the number of members of a power set is 2^n
...@@ -394,7 +394,7 @@ public class DefaultGroupHandler { ...@@ -394,7 +394,7 @@ public class DefaultGroupHandler {
394 // run a binary counter for the number of power elements 394 // run a binary counter for the number of power elements
395 // NOTE: Exclude empty set 395 // NOTE: Exclude empty set
396 for (long i = 1; i < powerElements; i++) { 396 for (long i = 1; i < powerElements; i++) {
397 - Set<DeviceId> neighborSubSet = new HashSet<DeviceId>(); 397 + Set<DeviceId> neighborSubSet = new HashSet<>();
398 for (int j = 0; j < elements; j++) { 398 for (int j = 0; j < elements; j++) {
399 if ((i >> j) % 2 == 1) { 399 if ((i >> j) % 2 == 1) {
400 neighborSubSet.add(list.get(j)); 400 neighborSubSet.add(list.get(j));
...@@ -411,7 +411,7 @@ public class DefaultGroupHandler { ...@@ -411,7 +411,7 @@ public class DefaultGroupHandler {
411 411
412 protected List<Integer> getSegmentIdsTobePairedWithNeighborSet(Set<DeviceId> neighbors) { 412 protected List<Integer> getSegmentIdsTobePairedWithNeighborSet(Set<DeviceId> neighbors) {
413 413
414 - List<Integer> nsSegmentIds = new ArrayList<Integer>(); 414 + List<Integer> nsSegmentIds = new ArrayList<>();
415 415
416 // Always pair up with no edge label 416 // Always pair up with no edge label
417 // If (neighbors.size() == 1) { 417 // If (neighbors.size() == 1) {
......
...@@ -63,7 +63,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { ...@@ -63,7 +63,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
63 sets = filterEdgeRouterOnlyPairings(sets); 63 sets = filterEdgeRouterOnlyPairings(sets);
64 log.debug("createGroupsAtTransitRouter: The size of neighbor powerset " 64 log.debug("createGroupsAtTransitRouter: The size of neighbor powerset "
65 + "for sw {} is {}", deviceId, sets.size()); 65 + "for sw {} is {}", deviceId, sets.size());
66 - Set<NeighborSet> nsSet = new HashSet<NeighborSet>(); 66 + Set<NeighborSet> nsSet = new HashSet<>();
67 for (Set<DeviceId> combo : sets) { 67 for (Set<DeviceId> combo : sets) {
68 if (combo.isEmpty()) { 68 if (combo.isEmpty()) {
69 continue; 69 continue;
...@@ -137,7 +137,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { ...@@ -137,7 +137,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
137 Set<DeviceId> updatedNeighbors) { 137 Set<DeviceId> updatedNeighbors) {
138 Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors); 138 Set<Set<DeviceId>> powerSet = getPowerSetOfNeighbors(updatedNeighbors);
139 139
140 - Set<DeviceId> tmp = new HashSet<DeviceId>(); 140 + Set<DeviceId> tmp = new HashSet<>();
141 tmp.addAll(updatedNeighbors); 141 tmp.addAll(updatedNeighbors);
142 tmp.remove(impactedNeighbor); 142 tmp.remove(impactedNeighbor);
143 Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp); 143 Set<Set<DeviceId>> tmpPowerSet = getPowerSetOfNeighbors(tmp);
...@@ -146,7 +146,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { ...@@ -146,7 +146,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
146 powerSet.removeAll(tmpPowerSet); 146 powerSet.removeAll(tmpPowerSet);
147 147
148 powerSet = filterEdgeRouterOnlyPairings(powerSet); 148 powerSet = filterEdgeRouterOnlyPairings(powerSet);
149 - Set<NeighborSet> nsSet = new HashSet<NeighborSet>(); 149 + Set<NeighborSet> nsSet = new HashSet<>();
150 for (Set<DeviceId> combo : powerSet) { 150 for (Set<DeviceId> combo : powerSet) {
151 if (combo.isEmpty()) { 151 if (combo.isEmpty()) {
152 continue; 152 continue;
...@@ -163,7 +163,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler { ...@@ -163,7 +163,7 @@ public class DefaultTransitGroupHandler extends DefaultGroupHandler {
163 } 163 }
164 164
165 private Set<Set<DeviceId>> filterEdgeRouterOnlyPairings(Set<Set<DeviceId>> sets) { 165 private Set<Set<DeviceId>> filterEdgeRouterOnlyPairings(Set<Set<DeviceId>> sets) {
166 - Set<Set<DeviceId>> fiteredSets = new HashSet<Set<DeviceId>>(); 166 + Set<Set<DeviceId>> fiteredSets = new HashSet<>();
167 for (Set<DeviceId> deviceSubSet : sets) { 167 for (Set<DeviceId> deviceSubSet : sets) {
168 if (deviceSubSet.size() > 1) { 168 if (deviceSubSet.size() > 1) {
169 boolean avoidEdgeRouterPairing = true; 169 boolean avoidEdgeRouterPairing = true;
......
...@@ -44,7 +44,7 @@ public class NeighborSet { ...@@ -44,7 +44,7 @@ public class NeighborSet {
44 public NeighborSet(Set<DeviceId> neighbors) { 44 public NeighborSet(Set<DeviceId> neighbors) {
45 checkNotNull(neighbors); 45 checkNotNull(neighbors);
46 this.edgeLabel = NO_EDGE_LABEL; 46 this.edgeLabel = NO_EDGE_LABEL;
47 - this.neighbors = new HashSet<DeviceId>(); 47 + this.neighbors = new HashSet<>();
48 this.neighbors.addAll(neighbors); 48 this.neighbors.addAll(neighbors);
49 } 49 }
50 50
...@@ -57,7 +57,7 @@ public class NeighborSet { ...@@ -57,7 +57,7 @@ public class NeighborSet {
57 public NeighborSet(Set<DeviceId> neighbors, int edgeLabel) { 57 public NeighborSet(Set<DeviceId> neighbors, int edgeLabel) {
58 checkNotNull(neighbors); 58 checkNotNull(neighbors);
59 this.edgeLabel = edgeLabel; 59 this.edgeLabel = edgeLabel;
60 - this.neighbors = new HashSet<DeviceId>(); 60 + this.neighbors = new HashSet<>();
61 this.neighbors.addAll(neighbors); 61 this.neighbors.addAll(neighbors);
62 } 62 }
63 63
...@@ -66,7 +66,7 @@ public class NeighborSet { ...@@ -66,7 +66,7 @@ public class NeighborSet {
66 */ 66 */
67 public NeighborSet() { 67 public NeighborSet() {
68 this.edgeLabel = NO_EDGE_LABEL; 68 this.edgeLabel = NO_EDGE_LABEL;
69 - this.neighbors = new HashSet<DeviceId>(); 69 + this.neighbors = new HashSet<>();
70 } 70 }
71 71
72 /** 72 /**
......
...@@ -44,7 +44,7 @@ public class SetTestAddCommand extends AbstractShellCommand { ...@@ -44,7 +44,7 @@ public class SetTestAddCommand extends AbstractShellCommand {
44 String[] values = null; 44 String[] values = null;
45 45
46 Set<String> set; 46 Set<String> set;
47 - Set<String> toAdd = new HashSet<String>(); 47 + Set<String> toAdd = new HashSet<>();
48 48
49 49
50 Serializer serializer = Serializer.using( 50 Serializer serializer = Serializer.using(
......
...@@ -49,7 +49,7 @@ public class SetTestGetCommand extends AbstractShellCommand { ...@@ -49,7 +49,7 @@ public class SetTestGetCommand extends AbstractShellCommand {
49 String[] values = null; 49 String[] values = null;
50 50
51 Set<String> set; 51 Set<String> set;
52 - Set<String> toCheck = new HashSet<String>(); 52 + Set<String> toCheck = new HashSet<>();
53 String output = ""; 53 String output = "";
54 54
55 Serializer serializer = Serializer.using( 55 Serializer serializer = Serializer.using(
......
...@@ -54,7 +54,7 @@ public class SetTestRemoveCommand extends AbstractShellCommand { ...@@ -54,7 +54,7 @@ public class SetTestRemoveCommand extends AbstractShellCommand {
54 String[] values = null; 54 String[] values = null;
55 55
56 Set<String> set; 56 Set<String> set;
57 - Set<String> givenValues = new HashSet<String>(); 57 + Set<String> givenValues = new HashSet<>();
58 Serializer serializer = Serializer.using( 58 Serializer serializer = Serializer.using(
59 new KryoNamespace.Builder().register(KryoNamespaces.BASIC).build()); 59 new KryoNamespace.Builder().register(KryoNamespaces.BASIC).build());
60 60
......
...@@ -626,7 +626,7 @@ public class VTNManager implements VTNService { ...@@ -626,7 +626,7 @@ public class VTNManager implements VTNService {
626 VirtualPort port = virtualPortService.getPort(portId); 626 VirtualPort port = virtualPortService.getPort(portId);
627 TenantNetwork network = tenantNetworkService 627 TenantNetwork network = tenantNetworkService
628 .getNetwork(port.networkId()); 628 .getNetwork(port.networkId());
629 - Collection<String> ifaceIds = new HashSet<String>(); 629 + Collection<String> ifaceIds = new HashSet<>();
630 Collection<VirtualPort> ports = virtualPortService 630 Collection<VirtualPort> ports = virtualPortService
631 .getPorts(network.id()); 631 .getPorts(network.id());
632 Sets.newHashSet(ports).stream() 632 Sets.newHashSet(ports).stream()
......
...@@ -149,7 +149,7 @@ public class SubnetWebResource extends AbstractWebResource { ...@@ -149,7 +149,7 @@ public class SubnetWebResource extends AbstractWebResource {
149 throws IOException { 149 throws IOException {
150 try { 150 try {
151 SubnetId subId = SubnetId.subnetId(id); 151 SubnetId subId = SubnetId.subnetId(id);
152 - Set<SubnetId> subIds = new HashSet<SubnetId>(); 152 + Set<SubnetId> subIds = new HashSet<>();
153 subIds.add(subId); 153 subIds.add(subId);
154 get(SubnetService.class).removeSubnets(subIds); 154 get(SubnetService.class).removeSubnets(subIds);
155 return Response.status(201).entity("SUCCESS").build(); 155 return Response.status(201).entity("SUCCESS").build();
...@@ -183,7 +183,7 @@ public class SubnetWebResource extends AbstractWebResource { ...@@ -183,7 +183,7 @@ public class SubnetWebResource extends AbstractWebResource {
183 */ 183 */
184 public Iterable<Subnet> changeJsonToSubs(JsonNode subnetNodes) { 184 public Iterable<Subnet> changeJsonToSubs(JsonNode subnetNodes) {
185 checkNotNull(subnetNodes, JSON_NOT_NULL); 185 checkNotNull(subnetNodes, JSON_NOT_NULL);
186 - Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>(); 186 + Map<SubnetId, Subnet> subMap = new HashMap<>();
187 for (JsonNode subnetNode : subnetNodes) { 187 for (JsonNode subnetNode : subnetNodes) {
188 if (!subnetNode.hasNonNull("id")) { 188 if (!subnetNode.hasNonNull("id")) {
189 return null; 189 return null;
...@@ -229,7 +229,7 @@ public class SubnetWebResource extends AbstractWebResource { ...@@ -229,7 +229,7 @@ public class SubnetWebResource extends AbstractWebResource {
229 checkNotNull(subnetNodes, JSON_NOT_NULL); 229 checkNotNull(subnetNodes, JSON_NOT_NULL);
230 checkArgument(subnetNodes.get("enable_dhcp").isBoolean(), "enable_dhcp should be boolean"); 230 checkArgument(subnetNodes.get("enable_dhcp").isBoolean(), "enable_dhcp should be boolean");
231 checkArgument(subnetNodes.get("shared").isBoolean(), "shared should be boolean"); 231 checkArgument(subnetNodes.get("shared").isBoolean(), "shared should be boolean");
232 - Map<SubnetId, Subnet> subMap = new HashMap<SubnetId, Subnet>(); 232 + Map<SubnetId, Subnet> subMap = new HashMap<>();
233 if (!subnetNodes.hasNonNull("id")) { 233 if (!subnetNodes.hasNonNull("id")) {
234 return null; 234 return null;
235 } 235 }
......
...@@ -240,7 +240,7 @@ public class TenantNetworkWebResource extends AbstractWebResource { ...@@ -240,7 +240,7 @@ public class TenantNetworkWebResource extends AbstractWebResource {
240 @Path("{id}") 240 @Path("{id}")
241 public Response deleteNetworks(@PathParam("id") String id) { 241 public Response deleteNetworks(@PathParam("id") String id) {
242 log.debug("Deletes network by identifier {}.", id); 242 log.debug("Deletes network by identifier {}.", id);
243 - Set<TenantNetworkId> networkSet = new HashSet<TenantNetworkId>(); 243 + Set<TenantNetworkId> networkSet = new HashSet<>();
244 networkSet.add(TenantNetworkId.networkId(id)); 244 networkSet.add(TenantNetworkId.networkId(id));
245 Boolean issuccess = nullIsNotFound(get(TenantNetworkService.class) 245 Boolean issuccess = nullIsNotFound(get(TenantNetworkService.class)
246 .removeNetworks(networkSet), NETWORK_NOT_FOUND); 246 .removeNetworks(networkSet), NETWORK_NOT_FOUND);
......
...@@ -131,7 +131,7 @@ public class VirtualPortWebResource extends AbstractWebResource { ...@@ -131,7 +131,7 @@ public class VirtualPortWebResource extends AbstractWebResource {
131 @Path("{portUUID}") 131 @Path("{portUUID}")
132 @DELETE 132 @DELETE
133 public Response deletePorts(@PathParam("portUUID") String id) { 133 public Response deletePorts(@PathParam("portUUID") String id) {
134 - Set<VirtualPortId> vPortIds = new HashSet<VirtualPortId>(); 134 + Set<VirtualPortId> vPortIds = new HashSet<>();
135 try { 135 try {
136 if (id != null) { 136 if (id != null) {
137 vPortIds.add(VirtualPortId.portId(id)); 137 vPortIds.add(VirtualPortId.portId(id));
...@@ -201,8 +201,8 @@ public class VirtualPortWebResource extends AbstractWebResource { ...@@ -201,8 +201,8 @@ public class VirtualPortWebResource extends AbstractWebResource {
201 */ 201 */
202 public Iterable<VirtualPort> changeJsonToPorts(JsonNode vPortNodes) { 202 public Iterable<VirtualPort> changeJsonToPorts(JsonNode vPortNodes) {
203 checkNotNull(vPortNodes, JSON_NOT_NULL); 203 checkNotNull(vPortNodes, JSON_NOT_NULL);
204 - Map<VirtualPortId, VirtualPort> portMap = new HashMap<VirtualPortId, VirtualPort>(); 204 + Map<VirtualPortId, VirtualPort> portMap = new HashMap<>();
205 - Map<String, String> strMap = new HashMap<String, String>(); 205 + Map<String, String> strMap = new HashMap<>();
206 for (JsonNode vPortnode : vPortNodes) { 206 for (JsonNode vPortnode : vPortNodes) {
207 VirtualPortId id = VirtualPortId.portId(vPortnode.get("id") 207 VirtualPortId id = VirtualPortId.portId(vPortnode.get("id")
208 .asText()); 208 .asText());
...@@ -220,7 +220,7 @@ public class VirtualPortWebResource extends AbstractWebResource { ...@@ -220,7 +220,7 @@ public class VirtualPortWebResource extends AbstractWebResource {
220 .asText()); 220 .asText());
221 String deviceOwner = vPortnode.get("device_owner").asText(); 221 String deviceOwner = vPortnode.get("device_owner").asText();
222 JsonNode fixedIpNodes = vPortNodes.get("fixed_ips"); 222 JsonNode fixedIpNodes = vPortNodes.get("fixed_ips");
223 - Set<FixedIp> fixedIps = new HashSet<FixedIp>(); 223 + Set<FixedIp> fixedIps = new HashSet<>();
224 for (JsonNode fixedIpNode : fixedIpNodes) { 224 for (JsonNode fixedIpNode : fixedIpNodes) {
225 FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode); 225 FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode);
226 fixedIps.add(fixedIp); 226 fixedIps.add(fixedIp);
...@@ -265,8 +265,8 @@ public class VirtualPortWebResource extends AbstractWebResource { ...@@ -265,8 +265,8 @@ public class VirtualPortWebResource extends AbstractWebResource {
265 */ 265 */
266 public Iterable<VirtualPort> changeJsonToPort(JsonNode vPortNodes) { 266 public Iterable<VirtualPort> changeJsonToPort(JsonNode vPortNodes) {
267 checkNotNull(vPortNodes, JSON_NOT_NULL); 267 checkNotNull(vPortNodes, JSON_NOT_NULL);
268 - Map<VirtualPortId, VirtualPort> vportMap = new HashMap<VirtualPortId, VirtualPort>(); 268 + Map<VirtualPortId, VirtualPort> vportMap = new HashMap<>();
269 - Map<String, String> strMap = new HashMap<String, String>(); 269 + Map<String, String> strMap = new HashMap<>();
270 VirtualPortId id = VirtualPortId.portId(vPortNodes.get("id").asText()); 270 VirtualPortId id = VirtualPortId.portId(vPortNodes.get("id").asText());
271 String name = vPortNodes.get("name").asText(); 271 String name = vPortNodes.get("name").asText();
272 TenantId tenantId = TenantId.tenantId(vPortNodes.get("tenant_id") 272 TenantId tenantId = TenantId.tenantId(vPortNodes.get("tenant_id")
...@@ -281,7 +281,7 @@ public class VirtualPortWebResource extends AbstractWebResource { ...@@ -281,7 +281,7 @@ public class VirtualPortWebResource extends AbstractWebResource {
281 .asText()); 281 .asText());
282 String deviceOwner = vPortNodes.get("device_owner").asText(); 282 String deviceOwner = vPortNodes.get("device_owner").asText();
283 JsonNode fixedIpNodes = vPortNodes.get("fixed_ips"); 283 JsonNode fixedIpNodes = vPortNodes.get("fixed_ips");
284 - Set<FixedIp> fixedIps = new HashSet<FixedIp>(); 284 + Set<FixedIp> fixedIps = new HashSet<>();
285 for (JsonNode fixedIpNode : fixedIpNodes) { 285 for (JsonNode fixedIpNode : fixedIpNodes) {
286 FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode); 286 FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode);
287 fixedIps.add(fixedIp); 287 fixedIps.add(fixedIp);
......