[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [exonerator/master] Use Java 7's diamond operator wherever possible.
commit 67949a1935e22caec3b21f9d2578128c67123316
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Thu Feb 23 14:11:34 2017 +0100
Use Java 7's diamond operator wherever possible.
Implements #21535.
---
.../torproject/exonerator/ExoneraTorDatabaseImporter.java | 8 +++-----
.../java/org/torproject/exonerator/ExoneraTorServlet.java | 14 +++++++-------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java b/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java
index c145c79..8930078 100644
--- a/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java
+++ b/src/main/java/org/torproject/exonerator/ExoneraTorDatabaseImporter.java
@@ -161,11 +161,9 @@ public class ExoneraTorDatabaseImporter {
/* Last and next parse histories containing paths of parsed files and
* last modified times. */
- private static SortedMap<String, Long>
- lastImportHistory = new TreeMap<String, Long>();
+ private static SortedMap<String, Long> lastImportHistory = new TreeMap<>();
- private static SortedMap<String, Long>
- nextImportHistory = new TreeMap<String, Long>();
+ private static SortedMap<String, Long> nextImportHistory = new TreeMap<>();
/* Read stats/exonerator-import-history file from disk and remember
* locally when files were last parsed. */
@@ -237,7 +235,7 @@ public class ExoneraTorDatabaseImporter {
private static void parseConsensus(RelayNetworkStatusConsensus consensus) {
for (NetworkStatusEntry entry : consensus.getStatusEntries().values()) {
if (entry.getFlags().contains("Running")) {
- Set<String> orAddresses = new HashSet<String>();
+ Set<String> orAddresses = new HashSet<>();
orAddresses.add(entry.getAddress());
for (String orAddressAndPort : entry.getOrAddresses()) {
orAddresses.add(orAddressAndPort.substring(0,
diff --git a/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java b/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java
index 0211d25..fe6b853 100644
--- a/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java
+++ b/src/main/java/org/torproject/exonerator/ExoneraTorServlet.java
@@ -201,7 +201,7 @@ public class ExoneraTorServlet extends HttpServlet {
* network and tell the user about it. */
List<String> addressesInSameNetwork = null;
if (statusEntries.isEmpty()) {
- addressesInSameNetwork = new ArrayList<String>();
+ addressesInSameNetwork = new ArrayList<>();
if (!relayIp.contains(":")) {
String address24 = this.convertIpV4ToHex(relayIp).substring(0, 6);
if (address24 != null) {
@@ -395,7 +395,7 @@ public class ExoneraTorServlet extends HttpServlet {
private SortedSet<Long> queryKnownConsensusValidAfterTimes(
Connection conn, String fromValidAfter, String toValidAfter) {
- SortedSet<Long> relevantConsensuses = new TreeSet<Long>();
+ SortedSet<Long> relevantConsensuses = new TreeSet<>();
try {
Statement statement = conn.createStatement();
String query = "SELECT DISTINCT validafter FROM statusentry "
@@ -419,7 +419,7 @@ public class ExoneraTorServlet extends HttpServlet {
private List<String[]> queryStatusEntries(Connection conn,
String relayIp, long timestamp,
SimpleDateFormat validAfterTimeFormat) {
- List<String[]> statusEntries = new ArrayList<String[]>();
+ List<String[]> statusEntries = new ArrayList<>();
String addressHex = !relayIp.contains(":")
? this.convertIpV4ToHex(relayIp) : this.convertIpV6ToHex(relayIp);
if (addressHex == null) {
@@ -441,8 +441,8 @@ public class ExoneraTorServlet extends HttpServlet {
ResultSet rs = cs.executeQuery();
while (rs.next()) {
byte[] rawstatusentry = rs.getBytes(1);
- SortedSet<String> addresses = new TreeSet<String>();
- SortedSet<String> addressesHex = new TreeSet<String>();
+ SortedSet<String> addresses = new TreeSet<>();
+ SortedSet<String> addressesHex = new TreeSet<>();
String nickname = null;
String exit = "U";
for (String line : new String(rawstatusentry).split("\n")) {
@@ -494,7 +494,7 @@ public class ExoneraTorServlet extends HttpServlet {
private List<String> queryAddressesInSame24(Connection conn,
String address24, long timestamp) {
- List<String> addressesInSameNetwork = new ArrayList<String>();
+ List<String> addressesInSameNetwork = new ArrayList<>();
try {
CallableStatement cs = conn.prepareCall(
"{call search_addresses_in_same_24 (?, ?)}");
@@ -518,7 +518,7 @@ public class ExoneraTorServlet extends HttpServlet {
private List<String> queryAddressesInSame48(Connection conn,
String address48, long timestamp) {
- List<String> addressesInSameNetwork = new ArrayList<String>();
+ List<String> addressesInSameNetwork = new ArrayList<>();
try {
CallableStatement cs = conn.prepareCall(
"{call search_addresses_in_same_48 (?, ?)}");
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits