From e12a03c8fc12c99f70a49f27034859f92b4e3994 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Thu, 22 Sep 2016 17:08:38 +0200 Subject: [PATCH] Mechanical code cleanup (commons) * Remove unnecessary type specifiers (use Java 7 <>) * Remove unnecessary "extends Object" declarations * Remove unnecessary semi-colons * Merge identical catch blocks * Remove redundant modifiers: - enum constructors are private by default - interface properties are public static final by default - interface methods are public abstract by default - interfaces are abstract by default - inner interfaces are static by default - inner classes in interfaces are public static by default Change-Id: If1805b63e52c1ab0c68983e7856e7ccf184cb2a9 Signed-off-by: Stephen Kitt --- .../opendaylight/controller/liblldp/EtherTypes.java | 4 ++-- .../opendaylight/controller/liblldp/Ethernet.java | 12 ++++++------ .../org/opendaylight/controller/liblldp/LLDPTLV.java | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java b/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java index e3c46fbf6a..de5834faee 100644 --- a/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java +++ b/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java @@ -32,7 +32,7 @@ public enum EtherTypes { private String description; private int number; - private EtherTypes(String description, int number) { + EtherTypes(String description, int number) { this.description = description; this.number = number; } @@ -95,7 +95,7 @@ public enum EtherTypes { } public static List getEtherTypesNameList() { - List ethertypesList = new ArrayList(); + List ethertypesList = new ArrayList<>(); for (EtherTypes type : EtherTypes.values()) { ethertypesList.add(type.toString()); } diff --git a/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java b/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java index ea861e00ca..c2d9e7003e 100644 --- a/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java +++ b/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java @@ -27,15 +27,15 @@ public class Ethernet extends Packet { // to add new coming packet classes public static final Map> etherTypeClassMap; static { - etherTypeClassMap = new HashMap>(); + etherTypeClassMap = new HashMap<>(); etherTypeClassMap.put(EtherTypes.LLDP.shortValue(), LLDP.class); } private static Map> fieldCoordinates = new LinkedHashMap>() { private static final long serialVersionUID = 1L; { - put(DMAC, new ImmutablePair(0, 48)); - put(SMAC, new ImmutablePair(48, 48)); - put(ETHT, new ImmutablePair(96, 16)); + put(DMAC, new ImmutablePair<>(0, 48)); + put(SMAC, new ImmutablePair<>(48, 48)); + put(ETHT, new ImmutablePair<>(96, 16)); } }; private final Map fieldValues; @@ -45,7 +45,7 @@ public class Ethernet extends Packet { */ public Ethernet() { super(); - fieldValues = new HashMap(); + fieldValues = new HashMap<>(); hdrFieldCoordMap = fieldCoordinates; hdrFieldsMap = fieldValues; } @@ -56,7 +56,7 @@ public class Ethernet extends Packet { */ public Ethernet(boolean writeAccess) { super(writeAccess); - fieldValues = new HashMap(); + fieldValues = new HashMap<>(); hdrFieldCoordMap = fieldCoordinates; hdrFieldsMap = fieldValues; } diff --git a/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java b/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java index 7b93d5f19c..3c5623475e 100644 --- a/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java +++ b/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java @@ -57,7 +57,7 @@ public class LLDPTLV extends Packet { private byte value; - private TLVType(byte value) { + TLVType(byte value) { this.value = value; } @@ -70,9 +70,9 @@ public class LLDPTLV extends Packet { private static final long serialVersionUID = 1L; { - put(TYPE, new MutablePair(0, 7)); - put(LENGTH, new MutablePair(7, 9)); - put(VALUE, new MutablePair(16, 0)); + put(TYPE, new MutablePair<>(0, 7)); + put(LENGTH, new MutablePair<>(7, 9)); + put(VALUE, new MutablePair<>(16, 0)); } }; @@ -84,7 +84,7 @@ public class LLDPTLV extends Packet { */ public LLDPTLV() { payload = null; - fieldValues = new HashMap(LLDPTLVFields); + fieldValues = new HashMap<>(LLDPTLVFields); hdrFieldCoordMap = fieldCoordinates; hdrFieldsMap = fieldValues; } -- 2.36.6