From c21773be3d8e5626f3830e35af8a6659cae24522 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 14 Jul 2015 12:12:04 +1200 Subject: Use diamond operator for generics --- src/org/traccar/BaseProtocol.java | 2 +- src/org/traccar/ServerManager.java | 2 +- src/org/traccar/command/FixPositioningCommand.java | 2 +- src/org/traccar/command/NoParameterCommand.java | 2 +- src/org/traccar/command/StringCommandTemplate.java | 2 +- src/org/traccar/database/ConnectionManager.java | 8 ++++---- src/org/traccar/database/DataManager.java | 2 +- src/org/traccar/database/PermissionsManager.java | 4 ++-- src/org/traccar/database/QueryBuilder.java | 8 ++++---- src/org/traccar/http/AsyncServlet.java | 6 +++--- src/org/traccar/model/Event.java | 2 +- src/org/traccar/protocol/ApelProtocolDecoder.java | 2 +- src/org/traccar/protocol/AtrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/AutoFonProtocolDecoder.java | 2 +- src/org/traccar/protocol/BceProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/CastelProtocolDecoder.java | 2 +- src/org/traccar/protocol/GalileoProtocolDecoder.java | 2 +- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/Mta6ProtocolDecoder.java | 2 +- src/org/traccar/protocol/NavisProtocolDecoder.java | 2 +- src/org/traccar/protocol/OrionProtocolDecoder.java | 2 +- src/org/traccar/protocol/PiligrimProtocolDecoder.java | 2 +- src/org/traccar/protocol/ProgressProtocolDecoder.java | 2 +- src/org/traccar/protocol/RuptelaProtocolDecoder.java | 2 +- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 2 +- src/org/traccar/protocol/Tlt2hProtocolDecoder.java | 2 +- src/org/traccar/protocol/TytanProtocolDecoder.java | 4 ++-- src/org/traccar/protocol/WialonProtocolDecoder.java | 2 +- 28 files changed, 39 insertions(+), 39 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index b345d3658..86bebacc7 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -26,7 +26,7 @@ import java.util.Map; public abstract class BaseProtocol implements Protocol { private final String name; - private Map commandTemplates = new HashMap(); + private Map commandTemplates = new HashMap<>(); public BaseProtocol(String name) { this.name = name; diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 04a3fc317..7fbefc94e 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -31,7 +31,7 @@ import org.jboss.netty.channel.ChannelPipeline; public class ServerManager { - private final List serverList = new LinkedList(); + private final List serverList = new LinkedList<>(); public void init() throws Exception { diff --git a/src/org/traccar/command/FixPositioningCommand.java b/src/org/traccar/command/FixPositioningCommand.java index 1304e1f3f..18d5f32fb 100644 --- a/src/org/traccar/command/FixPositioningCommand.java +++ b/src/org/traccar/command/FixPositioningCommand.java @@ -10,7 +10,7 @@ public class FixPositioningCommand extends GpsCommand { @Override public Map getReplacements() { - Map replacements = new HashMap(); + Map replacements = new HashMap<>(); replacements.put(FREQUENCY, data); return replacements; } diff --git a/src/org/traccar/command/NoParameterCommand.java b/src/org/traccar/command/NoParameterCommand.java index afb0f3aee..f4e139b7b 100644 --- a/src/org/traccar/command/NoParameterCommand.java +++ b/src/org/traccar/command/NoParameterCommand.java @@ -6,6 +6,6 @@ import java.util.Map; public class NoParameterCommand extends GpsCommand { @Override public Map getReplacements() { - return new HashMap(); + return new HashMap<>(); } } diff --git a/src/org/traccar/command/StringCommandTemplate.java b/src/org/traccar/command/StringCommandTemplate.java index 12470d441..3f326e534 100644 --- a/src/org/traccar/command/StringCommandTemplate.java +++ b/src/org/traccar/command/StringCommandTemplate.java @@ -8,7 +8,7 @@ import java.util.Map; public class StringCommandTemplate implements CommandTemplate { private String messageTemplate; - private Map, CommandValueConversion> converters = new HashMap, CommandValueConversion>(); + private Map, CommandValueConversion> converters = new HashMap<>(); public StringCommandTemplate(String template, Object... replacements) { this.messageTemplate = String.format(template, replacements); diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java index eb22379da..0d357a41c 100644 --- a/src/org/traccar/database/ConnectionManager.java +++ b/src/org/traccar/database/ConnectionManager.java @@ -31,9 +31,9 @@ import org.traccar.model.Position; public class ConnectionManager { - private Map activeDevices = new HashMap(); - private final Map positions = new HashMap(); - private final Map> listeners = new HashMap>(); + private Map activeDevices = new HashMap<>(); + private final Map positions = new HashMap<>(); + private final Map> listeners = new HashMap<>(); public void init(DataManager dataManager) { try { @@ -70,7 +70,7 @@ public class ConnectionManager { public synchronized Collection getInitialState(Collection devices) { - List result = new LinkedList(); + List result = new LinkedList<>(); for (long device : devices) { if (positions.containsKey(device)) { diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index b7ecac52b..48f3228ce 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -50,7 +50,7 @@ public class DataManager implements IdentityManager { private DataSource dataSource; - private final Map devices = new HashMap(); + private final Map devices = new HashMap<>(); private long devicesLastUpdate; private final long devicesRefreshDelay; diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index 683f54cb4..40783ad98 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -28,9 +28,9 @@ import org.traccar.model.User; public class PermissionsManager { - private final Map users = new HashMap(); + private final Map users = new HashMap<>(); - private final Map> permissions = new HashMap>(); + private final Map> permissions = new HashMap<>(); private Set getNotNull(long userId) { if (!permissions.containsKey(userId)) { diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index 583a18539..85881a736 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -36,7 +36,7 @@ import org.traccar.model.Factory; public class QueryBuilder { - private final Map> indexMap = new HashMap>(); + private final Map> indexMap = new HashMap<>(); private Connection connection; private PreparedStatement statement; private final String query; @@ -106,7 +106,7 @@ public class QueryBuilder { // Add to list List indexList = paramMap.get(name); if (indexList == null) { - indexList = new LinkedList(); + indexList = new LinkedList<>(); paramMap.put(name, indexList); } indexList.add(index); @@ -133,7 +133,7 @@ public class QueryBuilder { name = name.toLowerCase(); List result = indexMap.get(name); if (result == null) { - result = new LinkedList(); + result = new LinkedList<>(); } return result; } @@ -298,7 +298,7 @@ public class QueryBuilder { ResultSetMetaData resultMetaData = resultSet.getMetaData(); - List> processors = new LinkedList>(); + List> processors = new LinkedList<>(); Method[] methods = prototype.getClass().getMethods(); diff --git a/src/org/traccar/http/AsyncServlet.java b/src/org/traccar/http/AsyncServlet.java index 47ffda3ad..0fc1cd2fb 100644 --- a/src/org/traccar/http/AsyncServlet.java +++ b/src/org/traccar/http/AsyncServlet.java @@ -57,10 +57,10 @@ public class AsyncServlet extends BaseServlet { private boolean destroyed; private final long userId; - private final Set devices = new HashSet(); + private final Set devices = new HashSet<>(); private Timeout sessionTimeout; private Timeout requestTimeout; - private final Map positions = new HashMap(); + private final Map positions = new HashMap<>(); private AsyncContext activeContext; private void logEvent(String message) { @@ -177,7 +177,7 @@ public class AsyncServlet extends BaseServlet { } - private static final Map asyncSessions = new HashMap(); + private static final Map asyncSessions = new HashMap<>(); public static void sessionRefreshUser(long userId) { asyncSessions.remove(userId); diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java index 8f5678dff..71348ef8b 100644 --- a/src/org/traccar/model/Event.java +++ b/src/org/traccar/model/Event.java @@ -41,7 +41,7 @@ public abstract class Event { public Date getDeviceTime() { return deviceTime; } public void setDeviceTime(Date deviceTime) { this.deviceTime = deviceTime; } - private final Map other = new LinkedHashMap(); + private final Map other = new LinkedHashMap<>(); public void set(String key, Object value) { if (value != null && (!(value instanceof String) || !((String) value).isEmpty())) { other.put(key, value); diff --git a/src/org/traccar/protocol/ApelProtocolDecoder.java b/src/org/traccar/protocol/ApelProtocolDecoder.java index 9a25a4fff..6ce823a29 100644 --- a/src/org/traccar/protocol/ApelProtocolDecoder.java +++ b/src/org/traccar/protocol/ApelProtocolDecoder.java @@ -131,7 +131,7 @@ public class ApelProtocolDecoder extends BaseProtocolDecoder { // Position else if (hasDeviceId() && (type == MSG_TYPE_CURRENT_GPS_DATA || type == MSG_TYPE_STATE_FULL_INFO_T104 || type == MSG_TYPE_LOG_RECORDS)) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); int recordCount = 1; if (type == MSG_TYPE_LOG_RECORDS) { diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 1f8ec9a1f..1f777b12a 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -91,7 +91,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { // Send acknowledgement sendResponse(channel, remoteAddress, id, index); - List positions = new LinkedList(); + List positions = new LinkedList<>(); while (buf.readableBytes() >= MIN_DATA_LENGTH) { diff --git a/src/org/traccar/protocol/AutoFonProtocolDecoder.java b/src/org/traccar/protocol/AutoFonProtocolDecoder.java index 810d666dd..afc9a2d79 100644 --- a/src/org/traccar/protocol/AutoFonProtocolDecoder.java +++ b/src/org/traccar/protocol/AutoFonProtocolDecoder.java @@ -140,7 +140,7 @@ public class AutoFonProtocolDecoder extends BaseProtocolDecoder { int count = buf.readUnsignedByte() & 0x0f; buf.readUnsignedShort(); // total count - List positions = new LinkedList(); + List positions = new LinkedList<>(); for (int i = 0; i < count; i++) { positions.add(decodePosition(buf, true)); diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java index 4255ebde2..4d4f262e8 100644 --- a/src/org/traccar/protocol/BceProtocolDecoder.java +++ b/src/org/traccar/protocol/BceProtocolDecoder.java @@ -54,7 +54,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { return null; } - List positions = new LinkedList(); + List positions = new LinkedList<>(); while (buf.readableBytes() > 1) { @@ -79,7 +79,7 @@ public class BceProtocolDecoder extends BaseProtocolDecoder { // Read masks int mask; - List masks = new LinkedList(); + List masks = new LinkedList<>(); do { mask = buf.readUnsignedShort(); masks.add(mask); diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java index 3a09822b3..358f6bb1d 100644 --- a/src/org/traccar/protocol/CastelProtocolDecoder.java +++ b/src/org/traccar/protocol/CastelProtocolDecoder.java @@ -150,7 +150,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder { int count = buf.readUnsignedByte(); - List positions = new LinkedList(); + List positions = new LinkedList<>(); for (int i = 0; i < count; i++) { diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index 66eb1f2cc..b9a4eef44 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -51,7 +51,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { private static final int TAG_REFRIGERATOR = 0x5b; private static final int TAG_PRESSURE = 0x5c; - private static final Map tagLengthMap = new HashMap(); + private static final Map tagLengthMap = new HashMap<>(); static { int[] l1 = {0x01,0x02,0x35,0x43,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd5,0x88,0x8a,0x8b,0x8c,0xa0,0xaf,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae}; diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index adbaa6e58..2cdf75106 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -178,7 +178,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { } private List decodeBinaryMessage(Channel channel, ChannelBuffer buf) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); String flag = buf.toString(2, 1, Charset.defaultCharset()); int index = ChannelBufferTools.find(buf, 0, buf.readableBytes(), ","); diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index e83c84583..e751c8b7a 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -115,7 +115,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { } private List parseFormatA(ChannelBuffer buf) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); FloatReader latitudeReader = new FloatReader(); FloatReader longitudeReader = new FloatReader(); diff --git a/src/org/traccar/protocol/NavisProtocolDecoder.java b/src/org/traccar/protocol/NavisProtocolDecoder.java index 46d249fe7..4f3e6a1a4 100644 --- a/src/org/traccar/protocol/NavisProtocolDecoder.java +++ b/src/org/traccar/protocol/NavisProtocolDecoder.java @@ -225,7 +225,7 @@ public class NavisProtocolDecoder extends BaseProtocolDecoder { } private Object processArray(Channel channel, ChannelBuffer buf) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); int count = buf.readUnsignedByte(); for (int i = 0; i < count; i++) { diff --git a/src/org/traccar/protocol/OrionProtocolDecoder.java b/src/org/traccar/protocol/OrionProtocolDecoder.java index daf52750b..388178dad 100644 --- a/src/org/traccar/protocol/OrionProtocolDecoder.java +++ b/src/org/traccar/protocol/OrionProtocolDecoder.java @@ -77,7 +77,7 @@ public class OrionProtocolDecoder extends BaseProtocolDecoder { return null; } - List positions = new LinkedList(); + List positions = new LinkedList<>(); for (int i = 0; i < (header & 0x0f); i++) { diff --git a/src/org/traccar/protocol/PiligrimProtocolDecoder.java b/src/org/traccar/protocol/PiligrimProtocolDecoder.java index 7f6d9463e..fad9bc703 100644 --- a/src/org/traccar/protocol/PiligrimProtocolDecoder.java +++ b/src/org/traccar/protocol/PiligrimProtocolDecoder.java @@ -88,7 +88,7 @@ public class PiligrimProtocolDecoder extends BaseProtocolDecoder { return null; } - List positions = new LinkedList(); + List positions = new LinkedList<>(); ChannelBuffer buf = request.getContent(); while (buf.readableBytes() > 2) { diff --git a/src/org/traccar/protocol/ProgressProtocolDecoder.java b/src/org/traccar/protocol/ProgressProtocolDecoder.java index bb29532bf..8b57f52d0 100644 --- a/src/org/traccar/protocol/ProgressProtocolDecoder.java +++ b/src/org/traccar/protocol/ProgressProtocolDecoder.java @@ -87,7 +87,7 @@ public class ProgressProtocolDecoder extends BaseProtocolDecoder { // Position else if (hasDeviceId() && (type == MSG_POINT || type == MSG_ALARM || type == MSG_LOGMSG)) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); int recordCount = 1; if (type == MSG_LOGMSG) { diff --git a/src/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/org/traccar/protocol/RuptelaProtocolDecoder.java index b81b5b248..0064798f3 100644 --- a/src/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -53,7 +53,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { int type = buf.readUnsignedByte(); if (type == COMMAND_RECORDS) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); buf.readUnsignedByte(); // records left int count = buf.readUnsignedByte(); diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index eff04f7cf..e57723ddb 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -53,7 +53,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { private static final int CODEC_12 = 0x0C; private List parseLocation(Channel channel, ChannelBuffer buf) { - List positions = new LinkedList(); + List positions = new LinkedList<>(); buf.skipBytes(4); // marker buf.readUnsignedInt(); // data length diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java index b242a2232..3cdb9199a 100644 --- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java +++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java @@ -81,7 +81,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder { String status = parser.group(2); String[] messages = sentence.substring(sentence.indexOf('\n') + 1).split("\r\n"); - List positions = new LinkedList(); + List positions = new LinkedList<>(); for (String message : messages) { parser = patternPosition.matcher(message); diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index 432fa213e..558664e2d 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -58,7 +58,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { return null; } - List positions = new LinkedList(); + List positions = new LinkedList<>(); while (buf.readable()) { @@ -137,7 +137,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { break; case 24: { - Set temps = new LinkedHashSet(); + Set temps = new LinkedHashSet<>(); int temp = buf.readUnsignedByte(); for (int i = 3; i >= 0; i--) { int n = (temp >> (2 * i)) & 0x03; diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 5cf6cdab5..e79a7e9ee 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -200,7 +200,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { else if (sentence.startsWith("#B#")) { String[] messages = sentence.substring(sentence.indexOf('#', 1) + 1).split("\\|"); - List positions = new LinkedList(); + List positions = new LinkedList<>(); for (String message : messages) { Position position = decodePosition(message); -- cgit v1.2.3