Sho SHIMIZU
Committed by Gerrit Code Review

Use diamond operator

Change-Id: I966c7033fc97259b3c3727a07d552c675a9446a4
...@@ -17,7 +17,6 @@ package org.onosproject.net; ...@@ -17,7 +17,6 @@ package org.onosproject.net;
17 17
18 import org.onlab.junit.TestUtils; 18 import org.onlab.junit.TestUtils;
19 import org.onlab.packet.ChassisId; 19 import org.onlab.packet.ChassisId;
20 -import org.onlab.packet.IpAddress;
21 import org.onosproject.TestApplicationId; 20 import org.onosproject.TestApplicationId;
22 import org.onosproject.core.ApplicationId; 21 import org.onosproject.core.ApplicationId;
23 import org.onosproject.event.EventDeliveryService; 22 import org.onosproject.event.EventDeliveryService;
...@@ -67,7 +66,7 @@ public final class NetTestTools { ...@@ -67,7 +66,7 @@ public final class NetTestTools {
67 public static Host host(String id, String did) { 66 public static Host host(String id, String did) {
68 return new DefaultHost(PID, hid(id), valueOf(1234), vlanId((short) 2), 67 return new DefaultHost(PID, hid(id), valueOf(1234), vlanId((short) 2),
69 new HostLocation(did(did), portNumber(1), 321), 68 new HostLocation(did(did), portNumber(1), 321),
70 - new HashSet<IpAddress>()); 69 + new HashSet<>());
71 } 70 }
72 71
73 // Short-hand for creating a connection point. 72 // Short-hand for creating a connection point.
......
...@@ -64,7 +64,7 @@ public class VersionedTest extends TestCase { ...@@ -64,7 +64,7 @@ public class VersionedTest extends TestCase {
64 */ 64 */
65 @Test 65 @Test
66 public void testOrElse() { 66 public void testOrElse() {
67 - Versioned<String> vv = new Versioned<String>("foo", 1); 67 + Versioned<String> vv = new Versioned<>("foo", 1);
68 Versioned<String> nullVV = null; 68 Versioned<String> nullVV = null;
69 assertThat(Versioned.valueOrElse(vv, "bar"), is("foo")); 69 assertThat(Versioned.valueOrElse(vv, "bar"), is("foo"));
70 assertThat(Versioned.valueOrElse(nullVV, "bar"), is("bar")); 70 assertThat(Versioned.valueOrElse(nullVV, "bar"), is("bar"));
......
...@@ -176,8 +176,7 @@ public class LinkResourceManager ...@@ -176,8 +176,7 @@ public class LinkResourceManager
176 case MPLS_LABEL: 176 case MPLS_LABEL:
177 for (Link link : req.links()) { 177 for (Link link : req.links()) {
178 if (allocsPerLink.get(link) == null) { 178 if (allocsPerLink.get(link) == null) {
179 - allocsPerLink.put(link, 179 + allocsPerLink.put(link, new HashSet<>());
180 - new HashSet<ResourceAllocation>());
181 } 180 }
182 Iterator<MplsLabel> mplsIter = getAvailableMplsLabels(link) 181 Iterator<MplsLabel> mplsIter = getAvailableMplsLabels(link)
183 .iterator(); 182 .iterator();
...@@ -198,7 +197,7 @@ public class LinkResourceManager ...@@ -198,7 +197,7 @@ public class LinkResourceManager
198 197
199 Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>(); 198 Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
200 for (Link link : req.links()) { 199 for (Link link : req.links()) {
201 - allocations.put(link, new HashSet<ResourceAllocation>(allocs)); 200 + allocations.put(link, new HashSet<>(allocs));
202 Set<ResourceAllocation> linkAllocs = allocsPerLink.get(link); 201 Set<ResourceAllocation> linkAllocs = allocsPerLink.get(link);
203 if (linkAllocs != null) { 202 if (linkAllocs != null) {
204 allocations.get(link).addAll(linkAllocs); 203 allocations.get(link).addAll(linkAllocs);
......
...@@ -159,8 +159,8 @@ public class GroupManagerTest { ...@@ -159,8 +159,8 @@ public class GroupManagerTest {
159 PortNumber[] ports2 = {PortNumber.portNumber(41), 159 PortNumber[] ports2 = {PortNumber.portNumber(41),
160 PortNumber.portNumber(42)}; 160 PortNumber.portNumber(42)};
161 GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes()); 161 GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
162 - List<GroupBucket> buckets = new ArrayList<GroupBucket>(); 162 + List<GroupBucket> buckets = new ArrayList<>();
163 - List<PortNumber> outPorts = new ArrayList<PortNumber>(); 163 + List<PortNumber> outPorts = new ArrayList<>();
164 outPorts.addAll(Arrays.asList(ports1)); 164 outPorts.addAll(Arrays.asList(ports1));
165 outPorts.addAll(Arrays.asList(ports2)); 165 outPorts.addAll(Arrays.asList(ports2));
166 for (PortNumber portNumber: outPorts) { 166 for (PortNumber portNumber: outPorts) {
...@@ -270,14 +270,16 @@ public class GroupManagerTest { ...@@ -270,14 +270,16 @@ public class GroupManagerTest {
270 270
271 GroupKey prevKey = new DefaultGroupKey("group1BeforeAudit".getBytes()); 271 GroupKey prevKey = new DefaultGroupKey("group1BeforeAudit".getBytes());
272 Group createdGroup = groupService.getGroup(DID, prevKey); 272 Group createdGroup = groupService.getGroup(DID, prevKey);
273 - List<GroupBucket> buckets = new ArrayList<GroupBucket>(); 273 + List<GroupBucket> buckets = new ArrayList<>();
274 buckets.addAll(createdGroup.buckets().buckets()); 274 buckets.addAll(createdGroup.buckets().buckets());
275 275
276 PortNumber[] addPorts = {PortNumber.portNumber(51), 276 PortNumber[] addPorts = {PortNumber.portNumber(51),
277 PortNumber.portNumber(52)}; 277 PortNumber.portNumber(52)};
278 - List<PortNumber> outPorts = new ArrayList<PortNumber>(); 278 + List<PortNumber> outPorts;
279 + outPorts = new ArrayList<PortNumber>();
279 outPorts.addAll(Arrays.asList(addPorts)); 280 outPorts.addAll(Arrays.asList(addPorts));
280 - List<GroupBucket> addBuckets = new ArrayList<GroupBucket>(); 281 + List<GroupBucket> addBuckets;
282 + addBuckets = new ArrayList<GroupBucket>();
281 for (PortNumber portNumber: outPorts) { 283 for (PortNumber portNumber: outPorts) {
282 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); 284 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
283 tBuilder.setOutput(portNumber) 285 tBuilder.setOutput(portNumber)
...@@ -314,14 +316,14 @@ public class GroupManagerTest { ...@@ -314,14 +316,14 @@ public class GroupManagerTest {
314 316
315 GroupKey prevKey = new DefaultGroupKey("group1AddBuckets".getBytes()); 317 GroupKey prevKey = new DefaultGroupKey("group1AddBuckets".getBytes());
316 Group createdGroup = groupService.getGroup(DID, prevKey); 318 Group createdGroup = groupService.getGroup(DID, prevKey);
317 - List<GroupBucket> buckets = new ArrayList<GroupBucket>(); 319 + List<GroupBucket> buckets = new ArrayList<>();
318 buckets.addAll(createdGroup.buckets().buckets()); 320 buckets.addAll(createdGroup.buckets().buckets());
319 321
320 PortNumber[] removePorts = {PortNumber.portNumber(31), 322 PortNumber[] removePorts = {PortNumber.portNumber(31),
321 PortNumber.portNumber(32)}; 323 PortNumber.portNumber(32)};
322 - List<PortNumber> outPorts = new ArrayList<PortNumber>(); 324 + List<PortNumber> outPorts = new ArrayList<>();
323 outPorts.addAll(Arrays.asList(removePorts)); 325 outPorts.addAll(Arrays.asList(removePorts));
324 - List<GroupBucket> removeBuckets = new ArrayList<GroupBucket>(); 326 + List<GroupBucket> removeBuckets = new ArrayList<>();
325 for (PortNumber portNumber: outPorts) { 327 for (PortNumber portNumber: outPorts) {
326 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); 328 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
327 tBuilder.setOutput(portNumber) 329 tBuilder.setOutput(portNumber)
...@@ -380,8 +382,8 @@ public class GroupManagerTest { ...@@ -380,8 +382,8 @@ public class GroupManagerTest {
380 PortNumber.portNumber(42)}; 382 PortNumber.portNumber(42)};
381 // Test Group creation before AUDIT process 383 // Test Group creation before AUDIT process
382 GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes()); 384 GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
383 - List<GroupBucket> buckets = new ArrayList<GroupBucket>(); 385 + List<GroupBucket> buckets = new ArrayList<>();
384 - List<PortNumber> outPorts = new ArrayList<PortNumber>(); 386 + List<PortNumber> outPorts = new ArrayList<>();
385 outPorts.addAll(Arrays.asList(ports1)); 387 outPorts.addAll(Arrays.asList(ports1));
386 outPorts.addAll(Arrays.asList(ports2)); 388 outPorts.addAll(Arrays.asList(ports2));
387 for (PortNumber portNumber: outPorts) { 389 for (PortNumber portNumber: outPorts) {
...@@ -454,10 +456,10 @@ public class GroupManagerTest { ...@@ -454,10 +456,10 @@ public class GroupManagerTest {
454 private Group createSouthboundGroupEntry(GroupId gId, 456 private Group createSouthboundGroupEntry(GroupId gId,
455 List<PortNumber> ports, 457 List<PortNumber> ports,
456 long referenceCount) { 458 long referenceCount) {
457 - List<PortNumber> outPorts = new ArrayList<PortNumber>(); 459 + List<PortNumber> outPorts = new ArrayList<>();
458 outPorts.addAll(ports); 460 outPorts.addAll(ports);
459 461
460 - List<GroupBucket> buckets = new ArrayList<GroupBucket>(); 462 + List<GroupBucket> buckets = new ArrayList<>();
461 for (PortNumber portNumber: outPorts) { 463 for (PortNumber portNumber: outPorts) {
462 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder(); 464 TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
463 tBuilder.setOutput(portNumber) 465 tBuilder.setOutput(portNumber)
...@@ -499,7 +501,7 @@ public class GroupManagerTest { ...@@ -499,7 +501,7 @@ public class GroupManagerTest {
499 private class TestGroupProvider 501 private class TestGroupProvider
500 extends AbstractProvider implements GroupProvider { 502 extends AbstractProvider implements GroupProvider {
501 DeviceId lastDeviceId; 503 DeviceId lastDeviceId;
502 - List<GroupOperation> groupOperations = new ArrayList<GroupOperation>(); 504 + List<GroupOperation> groupOperations = new ArrayList<>();
503 505
504 protected TestGroupProvider(ProviderId id) { 506 protected TestGroupProvider(ProviderId id) {
505 super(id); 507 super(id);
......
...@@ -195,7 +195,7 @@ public class ProxyArpManagerTest { ...@@ -195,7 +195,7 @@ public class ProxyArpManagerTest {
195 * need is to occupy the ports with some link. 195 * need is to occupy the ports with some link.
196 */ 196 */
197 private void createLinks(int numDevices) { 197 private void createLinks(int numDevices) {
198 - List<Link> links = new ArrayList<Link>(); 198 + List<Link> links = new ArrayList<>();
199 199
200 for (int i = 1; i <= numDevices; i++) { 200 for (int i = 1; i <= numDevices; i++) {
201 ConnectPoint src = new ConnectPoint( 201 ConnectPoint src = new ConnectPoint(
......