Sho SHIMIZU
Committed by Gerrit Code Review

Use diamond operator

Change-Id: I966c7033fc97259b3c3727a07d552c675a9446a4
......@@ -17,7 +17,6 @@ package org.onosproject.net;
import org.onlab.junit.TestUtils;
import org.onlab.packet.ChassisId;
import org.onlab.packet.IpAddress;
import org.onosproject.TestApplicationId;
import org.onosproject.core.ApplicationId;
import org.onosproject.event.EventDeliveryService;
......@@ -67,7 +66,7 @@ public final class NetTestTools {
public static Host host(String id, String did) {
return new DefaultHost(PID, hid(id), valueOf(1234), vlanId((short) 2),
new HostLocation(did(did), portNumber(1), 321),
new HashSet<IpAddress>());
new HashSet<>());
}
// Short-hand for creating a connection point.
......
......@@ -64,7 +64,7 @@ public class VersionedTest extends TestCase {
*/
@Test
public void testOrElse() {
Versioned<String> vv = new Versioned<String>("foo", 1);
Versioned<String> vv = new Versioned<>("foo", 1);
Versioned<String> nullVV = null;
assertThat(Versioned.valueOrElse(vv, "bar"), is("foo"));
assertThat(Versioned.valueOrElse(nullVV, "bar"), is("bar"));
......
......@@ -176,8 +176,7 @@ public class LinkResourceManager
case MPLS_LABEL:
for (Link link : req.links()) {
if (allocsPerLink.get(link) == null) {
allocsPerLink.put(link,
new HashSet<ResourceAllocation>());
allocsPerLink.put(link, new HashSet<>());
}
Iterator<MplsLabel> mplsIter = getAvailableMplsLabels(link)
.iterator();
......@@ -198,7 +197,7 @@ public class LinkResourceManager
Map<Link, Set<ResourceAllocation>> allocations = new HashMap<>();
for (Link link : req.links()) {
allocations.put(link, new HashSet<ResourceAllocation>(allocs));
allocations.put(link, new HashSet<>(allocs));
Set<ResourceAllocation> linkAllocs = allocsPerLink.get(link);
if (linkAllocs != null) {
allocations.get(link).addAll(linkAllocs);
......
......@@ -159,8 +159,8 @@ public class GroupManagerTest {
PortNumber[] ports2 = {PortNumber.portNumber(41),
PortNumber.portNumber(42)};
GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
List<GroupBucket> buckets = new ArrayList<GroupBucket>();
List<PortNumber> outPorts = new ArrayList<PortNumber>();
List<GroupBucket> buckets = new ArrayList<>();
List<PortNumber> outPorts = new ArrayList<>();
outPorts.addAll(Arrays.asList(ports1));
outPorts.addAll(Arrays.asList(ports2));
for (PortNumber portNumber: outPorts) {
......@@ -270,14 +270,16 @@ public class GroupManagerTest {
GroupKey prevKey = new DefaultGroupKey("group1BeforeAudit".getBytes());
Group createdGroup = groupService.getGroup(DID, prevKey);
List<GroupBucket> buckets = new ArrayList<GroupBucket>();
List<GroupBucket> buckets = new ArrayList<>();
buckets.addAll(createdGroup.buckets().buckets());
PortNumber[] addPorts = {PortNumber.portNumber(51),
PortNumber.portNumber(52)};
List<PortNumber> outPorts = new ArrayList<PortNumber>();
List<PortNumber> outPorts;
outPorts = new ArrayList<PortNumber>();
outPorts.addAll(Arrays.asList(addPorts));
List<GroupBucket> addBuckets = new ArrayList<GroupBucket>();
List<GroupBucket> addBuckets;
addBuckets = new ArrayList<GroupBucket>();
for (PortNumber portNumber: outPorts) {
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
tBuilder.setOutput(portNumber)
......@@ -314,14 +316,14 @@ public class GroupManagerTest {
GroupKey prevKey = new DefaultGroupKey("group1AddBuckets".getBytes());
Group createdGroup = groupService.getGroup(DID, prevKey);
List<GroupBucket> buckets = new ArrayList<GroupBucket>();
List<GroupBucket> buckets = new ArrayList<>();
buckets.addAll(createdGroup.buckets().buckets());
PortNumber[] removePorts = {PortNumber.portNumber(31),
PortNumber.portNumber(32)};
List<PortNumber> outPorts = new ArrayList<PortNumber>();
List<PortNumber> outPorts = new ArrayList<>();
outPorts.addAll(Arrays.asList(removePorts));
List<GroupBucket> removeBuckets = new ArrayList<GroupBucket>();
List<GroupBucket> removeBuckets = new ArrayList<>();
for (PortNumber portNumber: outPorts) {
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
tBuilder.setOutput(portNumber)
......@@ -380,8 +382,8 @@ public class GroupManagerTest {
PortNumber.portNumber(42)};
// Test Group creation before AUDIT process
GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
List<GroupBucket> buckets = new ArrayList<GroupBucket>();
List<PortNumber> outPorts = new ArrayList<PortNumber>();
List<GroupBucket> buckets = new ArrayList<>();
List<PortNumber> outPorts = new ArrayList<>();
outPorts.addAll(Arrays.asList(ports1));
outPorts.addAll(Arrays.asList(ports2));
for (PortNumber portNumber: outPorts) {
......@@ -454,10 +456,10 @@ public class GroupManagerTest {
private Group createSouthboundGroupEntry(GroupId gId,
List<PortNumber> ports,
long referenceCount) {
List<PortNumber> outPorts = new ArrayList<PortNumber>();
List<PortNumber> outPorts = new ArrayList<>();
outPorts.addAll(ports);
List<GroupBucket> buckets = new ArrayList<GroupBucket>();
List<GroupBucket> buckets = new ArrayList<>();
for (PortNumber portNumber: outPorts) {
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
tBuilder.setOutput(portNumber)
......@@ -499,7 +501,7 @@ public class GroupManagerTest {
private class TestGroupProvider
extends AbstractProvider implements GroupProvider {
DeviceId lastDeviceId;
List<GroupOperation> groupOperations = new ArrayList<GroupOperation>();
List<GroupOperation> groupOperations = new ArrayList<>();
protected TestGroupProvider(ProviderId id) {
super(id);
......
......@@ -195,7 +195,7 @@ public class ProxyArpManagerTest {
* need is to occupy the ports with some link.
*/
private void createLinks(int numDevices) {
List<Link> links = new ArrayList<Link>();
List<Link> links = new ArrayList<>();
for (int i = 1; i <= numDevices; i++) {
ConnectPoint src = new ConnectPoint(
......