Do not use Lists.newArrayList() 48/80848/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 14 Mar 2019 10:14:02 +0000 (11:14 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 14 Mar 2019 11:01:09 +0000 (12:01 +0100)
We have star-constructors, which renders newArrayList() superfluous,
reduce its use.

Change-Id: Id6edab86975a810ad624c138ab74ac7e5623f321
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 files changed:
bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SimpleSessionListener.java
bgp/testtool/src/main/java/org/opendaylight/protocol/bgp/testtool/CommunitiesBuilder.java
bmp/bmp-mock/src/test/java/org/opendaylight/protocol/bmp/mock/BmpMockSessionTest.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSvecObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROExplicitExclusionRouteSubobjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OFListTlvParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated00/CInitiated00PCInitiateMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCReportMessageParser.java
pcep/ietf-stateful07/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful07/Stateful07PCUpdateRequestMessageParser.java
pcep/ietf-stateful07/src/test/java/org/opendaylight/protocol/pcep/ietf/PCEPValidatorTest.java
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsParser.java
pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/TestingSessionListener.java
programming/impl/src/test/java/org/opendaylight/bgpcep/programming/impl/MockedNotificationServiceWrapper.java
programming/impl/src/test/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImplTest.java
rsvp/impl/src/main/java/org/opendaylight/protocol/rsvp/parser/impl/subobject/ero/EROExplicitExclusionRouteSubobjectParser.java
rsvp/impl/src/test/java/org/opendaylight/protocol/rsvp/parser/impl/EROSubobjectParserTest.java

index 9d64ee6e798bb903a8859bfd1c23a3fae049851f..5e061f39cc32556f2125cf3ad3eef43427acd546 100644 (file)
@@ -17,6 +17,7 @@ import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -68,7 +69,7 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 public class BGPMessageParserMockTest {
 
     private final byte[][] inputBytes = new byte[11][];
-    private final List<Update> messages = Lists.newArrayList();
+    private final List<Update> messages = new ArrayList<>();
 
     @Before
     public void init() throws Exception {
@@ -140,7 +141,7 @@ public class BGPMessageParserMockTest {
 
         final UpdateBuilder builder = new UpdateBuilder();
 
-        final List<Segments> asPath = Lists.newArrayList();
+        final List<Segments> asPath = new ArrayList<>();
         asPath.add(new SegmentsBuilder().setAsSequence(Lists.newArrayList(new AsNumber(asn))).build());
         final CNextHop nextHop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(
                 new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8::1"))
@@ -180,7 +181,7 @@ public class BGPMessageParserMockTest {
         final Set<BgpTableType> type = Sets.newHashSet();
         type.add(new BgpTableTypeImpl(Ipv4AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class));
 
-        final List<BgpParameters> params = Lists.newArrayList();
+        final List<BgpParameters> params = new ArrayList<>();
 
         final CParameters par = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder()
                 .setMultiprotocolCapability(new MultiprotocolCapabilityBuilder().setAfi(Ipv4AddressFamily.class)
index 8826ddfdbadb57b4269464753fd21aca32da0221..2546e3e00d82c490297ba33cf1ef4504a2082067 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.Uninterruptibles;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -34,7 +34,7 @@ public final class SimpleSessionListener implements BGPSessionListener, Listener
 
     private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
     @GuardedBy("this")
-    private final List<Notification> listMsg = Lists.newArrayList();
+    private final List<Notification> listMsg = new ArrayList<>();
     private BGPSession bgpSession;
     private final CountDownLatch sessionLatch = new CountDownLatch(1);
 
index 18565c7b8c8f9faf11fc1e9de36ab33893030843..3d7b94b6f64efa59a007f7a036d62164b6ed4266 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.protocol.bgp.testtool;
 
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -59,7 +59,7 @@ final class CommunitiesBuilder {
     }
 
     static List<ExtendedCommunities> createExtComm(final List<String> extCom) {
-        final List<ExtendedCommunities> extendedCommunities = Lists.newArrayList();
+        final List<ExtendedCommunities> extendedCommunities = new ArrayList<>();
         for (String ec : extCom) {
             ExtendedCommunity community = null;
             switch (ec) {
index 294157fcf45878df78b0539df0186e096eb8236c..2188d7dc72e5614b5510452468e2fb9c01f4f8cd 100644 (file)
@@ -12,12 +12,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.Lists;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelPipeline;
 import java.net.InetSocketAddress;
+import java.util.ArrayList;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -42,7 +42,7 @@ public class BmpMockSessionTest {
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        this.messages = Lists.newArrayList();
+        this.messages = new ArrayList<>();
         this.session = new BmpMockSession(1, 1, 1);
         this.channel = Mockito.mock(Channel.class);
         Mockito.doReturn(REMOTE_ADDRESS).when(this.channel).remoteAddress();
index a65e7a5f01d899ad9762f852a81c1077935690fd..fb108722758ba34986ffd609ed7701283b781884 100644 (file)
@@ -10,9 +10,9 @@ package org.opendaylight.protocol.pcep.parser.object;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
@@ -71,7 +71,7 @@ public final class PCEPSvecObjectParser extends CommonObjectParser implements Ob
         }
         bytes.skipBytes(FLAGS_F_OFFSET);
         final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
-        final List<RequestId> requestIDs = Lists.newArrayList();
+        final List<RequestId> requestIDs = new ArrayList<>();
 
         while (bytes.isReadable()) {
             requestIDs.add(new RequestId(bytes.readUnsignedInt()));
index d42adf4f65b5ea1ec26f3d4ecd26b98d74e0a412..8cd69071ec9067faaa6e5f334395bc65a4be428b 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.pcep.parser.subobject;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
@@ -44,7 +43,7 @@ public class EROExplicitExclusionRouteSubobjectParser implements EROSubobjectPar
         final SubobjectBuilder builder = new SubobjectBuilder();
         builder.setLoose(loose);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject> list = parseSubobject(buffer);
-        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.Exrs> exrss = Lists.newArrayList();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.Exrs> exrss = new ArrayList<>();
         for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject s : list) {
             final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.ExrsBuilder b = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.exrs._case.exrs.ExrsBuilder();
             b.setAttribute(s.getAttribute());
index 16a1341a67e21aba151e3209ada6ee8ffb345855..054f4817a51d3545968443f5e8b8472c932f372d 100644 (file)
@@ -10,9 +10,9 @@ package org.opendaylight.protocol.pcep.parser.tlv;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.TlvParser;
@@ -40,7 +40,7 @@ public class OFListTlvParser implements TlvParser, TlvSerializer {
         if (buffer.readableBytes() % OF_CODE_ELEMENT_LENGTH != 0) {
             throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ".");
         }
-        final List<OfId> ofCodes = Lists.newArrayList();
+        final List<OfId> ofCodes = new ArrayList<>();
         while (buffer.isReadable()) {
             ofCodes.add(new OfId(buffer.readUnsignedShort()));
         }
index c646f0693dee97458bdcfb3a7ccc49f18f0d64f4..1c9fc8028aac3f7daf755e80430137ed09afae19 100644 (file)
@@ -9,9 +9,9 @@ package org.opendaylight.protocol.pcep.ietf.initiated00;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
 import org.opendaylight.protocol.pcep.spi.MessageUtil;
@@ -77,7 +77,7 @@ public class CInitiated00PCInitiateMessageParser extends AbstractMessageParser {
     protected Message validate(final List<Object> objects, final List<Message> errors) {
         checkArgument(objects != null, "Passed list can't be null.");
         final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
-        final List<Requests> reqs = Lists.newArrayList();
+        final List<Requests> reqs = new ArrayList<>();
         while (!objects.isEmpty()) {
             reqs.add(this.getValidRequest(objects));
         }
@@ -93,7 +93,7 @@ public class CInitiated00PCInitiateMessageParser extends AbstractMessageParser {
         builder.setLsp((Lsp) objects.get(0));
         objects.remove(0);
 
-        final List<Metrics> metrics = Lists.newArrayList();
+        final List<Metrics> metrics = new ArrayList<>();
 
         Object obj;
         State state = State.INIT;
index 1063cf2c2854a9908c6dc3f4324c2bd553650aca..530e42255f4ea369fc3af6d1bfb1239083083c6c 100644 (file)
@@ -9,9 +9,9 @@ package org.opendaylight.protocol.pcep.ietf.stateful07;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
@@ -93,7 +93,7 @@ public class Stateful07PCReportMessageParser extends AbstractMessageParser {
             throw new PCEPDeserializerException("Pcrpt message cannot be empty.");
         }
 
-        final List<Reports> reports = Lists.newArrayList();
+        final List<Reports> reports = new ArrayList<>();
 
         while (!objects.isEmpty()) {
             final Reports report = getValidReports(objects, errors);
@@ -171,7 +171,7 @@ public class Stateful07PCReportMessageParser extends AbstractMessageParser {
     }
 
     private static void parsePath(final List<Object> objects, final PathBuilder builder) {
-        final List<Metrics> pathMetrics = Lists.newArrayList();
+        final List<Metrics> pathMetrics = new ArrayList<>();
         Object obj;
         State state = State.INIT;
         while (!objects.isEmpty() && !state.equals(State.END)) {
index 827d0c9f9214df273469a902d78a8ac3eaedbbfe..b8d383752c3462c7f2d6bb2179ecd10b01085453 100644 (file)
@@ -9,9 +9,9 @@ package org.opendaylight.protocol.pcep.ietf.stateful07;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
@@ -88,7 +88,7 @@ public class Stateful07PCUpdateRequestMessageParser extends AbstractMessageParse
             throw new PCEPDeserializerException("Pcup message cannot be empty.");
         }
 
-        final List<Updates> updateRequests = Lists.newArrayList();
+        final List<Updates> updateRequests = new ArrayList<>();
 
         while (!objects.isEmpty()) {
             final Updates upd = getValidUpdates(objects, errors);
@@ -155,7 +155,7 @@ public class Stateful07PCUpdateRequestMessageParser extends AbstractMessageParse
     }
 
     private static void parsePath(final List<Object> objects, final PathBuilder pathBuilder) {
-        final List<Metrics> pathMetrics = Lists.newArrayList();
+        final List<Metrics> pathMetrics = new ArrayList<>();
         Object obj;
         State state = State.INIT;
         while (!objects.isEmpty() && !state.equals(State.END)) {
index d34600c2451935ead1fa87c835b798800359782e..0432b9f57a543f803a2bc152d9123e51cfc0aba9 100644 (file)
@@ -227,7 +227,7 @@ public class PCEPValidatorTest {
         final IroBuilder iroBuilder = new IroBuilder();
         iroBuilder.setIgnore(false);
         iroBuilder.setProcessingRule(false);
-        final List<Subobject> iroSubs = Lists.newArrayList();
+        final List<Subobject> iroSubs = new ArrayList<>();
         iroSubs.add(new SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
         iroBuilder.setSubobject(iroSubs);
         this.iro = iroBuilder.build();
@@ -236,7 +236,7 @@ public class PCEPValidatorTest {
         eroBuilder.setIgnore(false);
         eroBuilder.setProcessingRule(false);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route
-            .object.ero.Subobject> eroSubs = Lists.newArrayList();
+            .object.ero.Subobject> eroSubs = new ArrayList<>();
         eroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit
             .route.object.ero.SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
         eroBuilder.setSubobject(eroSubs);
@@ -246,7 +246,7 @@ public class PCEPValidatorTest {
         rroBuilder.setIgnore(false);
         rroBuilder.setProcessingRule(false);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route
-            .object.rro.Subobject> rroSubs = Lists.newArrayList();
+            .object.rro.Subobject> rroSubs = new ArrayList<>();
         rroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported
             .route.object.rro.SubobjectBuilder().setSubobjectType(this.rroUnnumberedSub).setProtectionAvailable(false)
             .setProtectionInUse(false).build());
@@ -361,7 +361,7 @@ public class PCEPValidatorTest {
 
             final PcupdMessageBuilder builder = new PcupdMessageBuilder();
 
-            final List<Updates> updates = Lists.newArrayList();
+            final List<Updates> updates = new ArrayList<>();
             final PathBuilder pBuilder = new PathBuilder();
             pBuilder.setEro(this.ero);
             pBuilder.setLspa(this.lspa);
@@ -375,7 +375,7 @@ public class PCEPValidatorTest {
             parser.serializeMessage(new PcupdBuilder().setPcupdMessage(builder.build()).build(), buf);
             assertArrayEquals(result.array(), buf.array());
 
-            final List<Updates> updates1 = Lists.newArrayList();
+            final List<Updates> updates1 = new ArrayList<>();
             final PathBuilder pBuilder1 = new PathBuilder();
             pBuilder1.setEro(this.ero);
             pBuilder1.setLspa(this.lspa);
@@ -405,7 +405,7 @@ public class PCEPValidatorTest {
 
             final PcrptMessageBuilder builder = new PcrptMessageBuilder();
 
-            final List<Reports> reports = Lists.newArrayList();
+            final List<Reports> reports = new ArrayList<>();
             reports.add(new ReportsBuilder().setLsp(this.lsp).build());
             builder.setReports(reports);
             final Message parseResult = parser.parseMessage(result.slice(4, result.readableBytes() - 4),
@@ -417,7 +417,7 @@ public class PCEPValidatorTest {
 
             result = Unpooled.wrappedBuffer(PCRT2);
 
-            final List<Reports> reports1 = Lists.newArrayList();
+            final List<Reports> reports1 = new ArrayList<>();
             reports1.add(new ReportsBuilder().setLsp(this.lsp).setPath(new org.opendaylight.yang.gen.v1.urn.opendaylight
                     .params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt.message.pcrpt.message.reports.PathBuilder()
                         .setEro(this.ero).setLspa(this.lspa).build()).build());
@@ -432,7 +432,7 @@ public class PCEPValidatorTest {
 
             result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRpt.3.bin"));
 
-            final List<Reports> reports2 = Lists.newArrayList();
+            final List<Reports> reports2 = new ArrayList<>();
             final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt
                 .message.pcrpt.message.reports.PathBuilder pBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight
                     .params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt.message.pcrpt.message.reports.PathBuilder();
@@ -451,7 +451,7 @@ public class PCEPValidatorTest {
 
             result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRpt.5.bin"));
 
-            final List<Reports> reports3 = Lists.newArrayList();
+            final List<Reports> reports3 = new ArrayList<>();
             final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt
                 .message.pcrpt.message.reports.PathBuilder pBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight
                 .params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt.message.pcrpt.message.reports.PathBuilder();
@@ -471,7 +471,7 @@ public class PCEPValidatorTest {
 
             result = Unpooled.wrappedBuffer(PCRT3);
 
-            final List<Reports> reports4 = Lists.newArrayList();
+            final List<Reports> reports4 = new ArrayList<>();
             reports4.add(new ReportsBuilder().setLsp(this.lsp).setPath(new org.opendaylight.yang.gen.v1.urn.opendaylight
                 .params.xml.ns.yang.pcep.ietf.stateful.rev181109.pcrpt.message.pcrpt.message.reports.PathBuilder()
                     .setEro(this.ero).setLspa(this.lspa).setBandwidth(this.bandwidth)
@@ -499,7 +499,7 @@ public class PCEPValidatorTest {
             final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
             final RequestsBuilder rBuilder = new RequestsBuilder();
 
-            final List<Requests> reqs = Lists.newArrayList();
+            final List<Requests> reqs = new ArrayList<>();
             rBuilder.setSrp(this.srp);
             rBuilder.setLsp(this.lspSrp);
             rBuilder.setEro(this.ero);
@@ -572,7 +572,7 @@ public class PCEPValidatorTest {
                 .rp.object.rp.TlvsBuilder().build());
             rpBuilder.setProcessingRule(false);
             final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr
-                .message.pcerr.message.error.type.request._case.request.Rps> rps = Lists.newArrayList();
+                .message.pcerr.message.error.type.request._case.request.Rps> rps = new ArrayList<>();
             rps.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr
                 .message.pcerr.message.error.type.request._case.request.RpsBuilder().setRp(rpBuilder.build()).build());
 
@@ -649,7 +649,7 @@ public class PCEPValidatorTest {
             builder.setPcerrMessage(errMsgBuilder.build());
 
             final ByteBuf buf = Unpooled.wrappedBuffer(statefulMsg);
-            final List<Message> errors = Lists.newArrayList();
+            final List<Message> errors = new ArrayList<>();
             parser.parseMessage(buf.slice(4, buf.readableBytes() - 4), errors);
             assertFalse(errors.isEmpty());
             assertEquals(builder.build(), errors.get(0));
@@ -696,7 +696,7 @@ public class PCEPValidatorTest {
             builder.setPcerrMessage(errMsgBuilder.build());
 
             final ByteBuf buf = Unpooled.wrappedBuffer(badUpdateMsg);
-            final List<Message> errors = Lists.newArrayList();
+            final List<Message> errors = new ArrayList<>();
             parser.parseMessage(buf.slice(4, buf.readableBytes() - 4), errors);
             assertFalse(errors.isEmpty());
             assertEquals(builder.build(), errors.get(0));
index 22c89d600c2075aafad1fe11c99909117c5af6b9..8fd30c66f477605351b371bda16dd6765fbb3960 100644 (file)
@@ -7,12 +7,12 @@
  */
 package org.opendaylight.protocol.pcep.spi;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
@@ -37,11 +37,11 @@ public abstract class AbstractObjectWithTlvsParser<T> extends CommonObjectParser
     }
 
     protected final void parseTlvs(final T builder, final ByteBuf bytes) throws PCEPDeserializerException {
-        Preconditions.checkArgument(bytes != null, "Array of bytes is mandatory. Can't be null.");
+        checkArgument(bytes != null, "Array of bytes is mandatory. Can't be null.");
         if (!bytes.isReadable()) {
             return;
         }
-        final List<VendorInformationTlv> viTlvs = Lists.newArrayList();
+        final List<VendorInformationTlv> viTlvs = new ArrayList<>();
         while (bytes.isReadable()) {
             final int type = bytes.readUnsignedShort();
             final int length = bytes.readUnsignedShort();
index 877fc062c834d7d246bf5fde60e8f824ffd1e887..ce861f4e40fe637526418b8136ae24d56ed3fa70 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.protocol.pcep.testtool;
 
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.protocol.pcep.PCEPSessionListener;
@@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
 public class TestingSessionListener implements PCEPSessionListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(TestingSessionListener.class);
-    private final List<Message> messages = Lists.newArrayList();
+    private final List<Message> messages = new ArrayList<>();
     private boolean up = false;
 
     @Override
index 8285f5913dc0cbfbd94920cbe0e06a6c090806b4..044f0e897535fc316eea0f277ff8531646c5944d 100644 (file)
@@ -14,7 +14,7 @@ import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.mock;
 import static org.opendaylight.protocol.util.CheckTestUtil.checkEquals;
 
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.List;
 import org.junit.Assert;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
@@ -24,11 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programm
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 final class MockedNotificationServiceWrapper {
-    private final List<Notification> publishedNotifications;
-
-    MockedNotificationServiceWrapper() {
-        this.publishedNotifications = Lists.newArrayList();
-    }
+    private final List<Notification> publishedNotifications = new ArrayList<>();
 
     NotificationPublishService getMockedNotificationService() throws InterruptedException {
         final NotificationPublishService mockedNotificationService = mock(NotificationPublishService.class);
index 80dd6c365baaebc3043773ff312d2af30c378b9a..3115d57a6df83ef10b1b3778edc175b16d250409 100644 (file)
@@ -22,6 +22,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
 import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.junit.After;
@@ -342,7 +343,7 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
         final SubmitInstructionInput mockedSubmitInstruction = mock(SubmitInstructionInput.class);
 
         doReturn(PcepUpdateTunnelInput.class).when(mockedSubmitInstruction).getImplementedInterface();
-        final List<InstructionId> dependencies = Lists.newArrayList();
+        final List<InstructionId> dependencies = new ArrayList<>();
         for (final String dependencyId : dependencyIds) {
             dependencies.add(new InstructionId(dependencyId));
         }
index 68bb0323b705ad078085dbfab152109a711ced0f..9972783f0a83fbaff5214a6cdcee6be4053d89df 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.protocol.rsvp.parser.impl.subobject.ero;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
@@ -47,7 +46,7 @@ public class EROExplicitExclusionRouteSubobjectParser implements EROSubobjectPar
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route
             .object.exclude.route.object.SubobjectContainer> list = localParseSubobject(buffer);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
-            .subobjects.subobject.type.exrs._case.exrs.Exrs> exrss = Lists.newArrayList();
+            .subobjects.subobject.type.exrs._case.exrs.Exrs> exrss = new ArrayList<>();
         for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route
             .object.exclude.route.object.SubobjectContainer s : list) {
             final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
index 5bf4db6df49856af2a67ef52a02da474af7724d5..377ed5ab8b7b4023a95564b4a65999071486a3a7 100644 (file)
@@ -9,9 +9,9 @@ package org.opendaylight.protocol.rsvp.parser.impl;
 
 import static org.junit.Assert.assertEquals;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
 import java.util.List;
 import org.junit.After;
 import org.junit.Assert;
@@ -295,7 +295,7 @@ public class EROSubobjectParserTest {
         final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
         subs.setLoose(true);
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
-            .subobjects.subobject.type.exrs._case.exrs.Exrs> list = Lists.newArrayList();
+            .subobjects.subobject.type.exrs._case.exrs.Exrs> list = new ArrayList<>();
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
             .subobjects.subobject.type.exrs._case.exrs.ExrsBuilder builder =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp