[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Use Java 7's diamond operator wherever possible.



commit 56ea752af2b4f614f08b2ab1017e77bbf6a88f9a
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Feb 23 14:17:27 2017 +0100

    Use Java 7's diamond operator wherever possible.
    
    Implements #21535.
---
 .../bridgedescs/BridgeSnapshotReader.java          |  6 ++---
 .../bridgedescs/SanitizedBridgesWriter.java        | 13 +++++-----
 .../collector/exitlists/ExitListDownloader.java    |  8 +++----
 .../collector/index/CreateIndexJson.java           |  8 +++----
 .../collector/relaydescs/ArchiveReader.java        | 10 ++++----
 .../collector/relaydescs/ArchiveWriter.java        | 28 ++++++++++------------
 .../relaydescs/CachedRelayDescriptorReader.java    |  8 +++----
 .../collector/relaydescs/ReferenceChecker.java     |  8 +++----
 .../relaydescs/RelayDescriptorDownloader.java      | 17 +++++++------
 .../relaydescs/RelayDescriptorParser.java          | 10 ++++----
 .../collector/torperf/TorperfDownloader.java       | 16 ++++++-------
 11 files changed, 61 insertions(+), 71 deletions(-)

diff --git a/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java b/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
index 0552307..9ffdf10 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
@@ -45,7 +45,7 @@ public class BridgeSnapshotReader {
       throw new IllegalArgumentException();
     }
 
-    SortedSet<String> parsed = new TreeSet<String>();
+    SortedSet<String> parsed = new TreeSet<>();
     File bdDir = bridgeDirectoriesDir;
     File pbdFile = new File(statsDirectory, "parsed-bridge-directories");
     boolean modified = false;
@@ -69,7 +69,7 @@ public class BridgeSnapshotReader {
       }
       logger.debug("Importing files in directory " + bridgeDirectoriesDir
           + "/...");
-      Set<String> descriptorImportHistory = new HashSet<String>();
+      Set<String> descriptorImportHistory = new HashSet<>();
       int parsedFiles = 0;
       int skippedFiles = 0;
       int parsedStatuses = 0;
@@ -77,7 +77,7 @@ public class BridgeSnapshotReader {
       int skippedServerDescriptors = 0;
       int parsedExtraInfoDescriptors = 0;
       int skippedExtraInfoDescriptors = 0;
-      Stack<File> filesInInputDir = new Stack<File>();
+      Stack<File> filesInInputDir = new Stack<>();
       filesInInputDir.add(bdDir);
       while (!filesInInputDir.isEmpty()) {
         File pop = filesInInputDir.pop();
diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
index 45a7565..beeb944 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
@@ -152,7 +152,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
 
     /* Read hex-encoded secrets for replacing IP addresses with hashes
      * from disk. */
-    this.secretsForHashingIpAddresses = new TreeMap<String, byte[]>();
+    this.secretsForHashingIpAddresses = new TreeMap<>();
     this.bridgeIpSecretsFile = new File(statsDirectory,
         "bridge-ip-secrets");
     if (this.bridgeIpSecretsFile.exists()) {
@@ -291,7 +291,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
         /* Invalid IPv6 address. */
         return null;
       }
-      List<String> hexParts = new ArrayList<String>();
+      List<String> hexParts = new ArrayList<>();
       for (String doubleColonSeparatedPart : doubleColonSeparatedParts) {
         StringBuilder hexPart = new StringBuilder();
         String[] parts = doubleColonSeparatedPart.split(":", -1);
@@ -461,8 +461,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
 
     /* Parse the given network status line by line. */
     StringBuilder header = new StringBuilder();
-    SortedMap<String, String> scrubbedLines =
-        new TreeMap<String, String>();
+    SortedMap<String, String> scrubbedLines = new TreeMap<>();
     try {
       StringBuilder scrubbed = new StringBuilder();
       BufferedReader br = new BufferedReader(new StringReader(new String(
@@ -692,7 +691,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
          * read the fingerprint. */
         } else if (line.startsWith("or-address ")) {
           if (orAddresses == null) {
-            orAddresses = new ArrayList<String>();
+            orAddresses = new ArrayList<>();
           }
           orAddresses.add(line.substring("or-address ".length()));
 
@@ -732,7 +731,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
             scrubbedAddress = scrubIpv4Address(address, fingerprintBytes,
                 published);
             if (orAddresses != null) {
-              scrubbedOrAddresses = new ArrayList<String>();
+              scrubbedOrAddresses = new ArrayList<>();
               for (String orAddress : orAddresses) {
                 String scrubbedOrAddress = scrubOrAddress(orAddress,
                     fingerprintBytes, published);
@@ -1395,7 +1394,7 @@ public class SanitizedBridgesWriter extends CollecTorMain {
   public void cleanUpRsyncDirectory() throws ConfigurationException {
     long cutOffMillis = System.currentTimeMillis()
         - 3L * 24L * 60L * 60L * 1000L;
-    Stack<File> allFiles = new Stack<File>();
+    Stack<File> allFiles = new Stack<>();
     allFiles.add(new File(config.getPath(Key.RecentPath).toFile(),
         BRIDGE_DESCRIPTORS));
     while (!allFiles.isEmpty()) {
diff --git a/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java b/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
index 0ac5112..7b8ccc4 100644
--- a/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
+++ b/src/main/java/org/torproject/collector/exitlists/ExitListDownloader.java
@@ -162,13 +162,13 @@ public class ExitListDownloader extends CollecTorMain {
     /* Write stats. */
     StringBuilder dumpStats = new StringBuilder("Finished downloading "
         + "exit list.\nLast three exit lists are:");
-    Stack<File> filesInInputDir = new Stack<File>();
+    Stack<File> filesInInputDir = new Stack<>();
     filesInInputDir.add(new File(outputPathName));
-    SortedSet<File> lastThreeExitLists = new TreeSet<File>();
+    SortedSet<File> lastThreeExitLists = new TreeSet<>();
     while (!filesInInputDir.isEmpty()) {
       File pop = filesInInputDir.pop();
       if (pop.isDirectory()) {
-        SortedSet<File> lastThreeElements = new TreeSet<File>();
+        SortedSet<File> lastThreeElements = new TreeSet<>();
         for (File f : pop.listFiles()) {
           lastThreeElements.add(f);
         }
@@ -198,7 +198,7 @@ public class ExitListDownloader extends CollecTorMain {
   public void cleanUpRsyncDirectory() throws ConfigurationException {
     long cutOffMillis = System.currentTimeMillis()
         - 3L * 24L * 60L * 60L * 1000L;
-    Stack<File> allFiles = new Stack<File>();
+    Stack<File> allFiles = new Stack<>();
     allFiles.add(new File(recentPathName));
     while (!allFiles.isEmpty()) {
       File file = allFiles.pop();
diff --git a/src/main/java/org/torproject/collector/index/CreateIndexJson.java b/src/main/java/org/torproject/collector/index/CreateIndexJson.java
index ba3ea7b..4b1b8f0 100644
--- a/src/main/java/org/torproject/collector/index/CreateIndexJson.java
+++ b/src/main/java/org/torproject/collector/index/CreateIndexJson.java
@@ -148,8 +148,7 @@ public class CreateIndexJson extends CollecTorMain {
   }
 
   private IndexNode indexDirectories() {
-    SortedSet<DirectoryNode> directoryNodes =
-        new TreeSet<DirectoryNode>();
+    SortedSet<DirectoryNode> directoryNodes = new TreeSet<>();
     logger.trace("indexing: " + indexedDirectories[0] + " "
         + indexedDirectories[1]);
     for (File directory : indexedDirectories) {
@@ -165,9 +164,8 @@ public class CreateIndexJson extends CollecTorMain {
   }
 
   private DirectoryNode indexDirectory(File directory) {
-    SortedSet<FileNode> fileNodes = new TreeSet<FileNode>();
-    SortedSet<DirectoryNode> directoryNodes =
-        new TreeSet<DirectoryNode>();
+    SortedSet<FileNode> fileNodes = new TreeSet<>();
+    SortedSet<DirectoryNode> directoryNodes = new TreeSet<>();
     logger.trace("indexing: " + directory);
     File[] fileList = directory.listFiles();
     if (null == fileList) {
diff --git a/src/main/java/org/torproject/collector/relaydescs/ArchiveReader.java b/src/main/java/org/torproject/collector/relaydescs/ArchiveReader.java
index a4c19cf..88b2525 100644
--- a/src/main/java/org/torproject/collector/relaydescs/ArchiveReader.java
+++ b/src/main/java/org/torproject/collector/relaydescs/ArchiveReader.java
@@ -43,7 +43,7 @@ public class ArchiveReader {
       ArchiveReader.class);
 
   private Map<String, Set<String>> microdescriptorValidAfterTimes =
-      new HashMap<String, Set<String>>();
+      new HashMap<>();
 
   /** Reads all descriptors from the given directory, possibly using a
    * parse history file, and passes them to the given descriptor
@@ -59,7 +59,7 @@ public class ArchiveReader {
     rdp.setArchiveReader(this);
     int parsedFiles = 0;
     int ignoredFiles = 0;
-    SortedSet<String> archivesImportHistory = new TreeSet<String>();
+    SortedSet<String> archivesImportHistory = new TreeSet<>();
     File archivesImportHistoryFile = new File(statsDirectory,
         "archives-import-history");
     if (keepImportHistory && archivesImportHistoryFile.exists()) {
@@ -79,10 +79,10 @@ public class ArchiveReader {
     if (archivesDirectory.exists()) {
       logger.debug("Importing files in directory " + archivesDirectory
           + "/...");
-      Stack<File> filesInInputDir = new Stack<File>();
+      Stack<File> filesInInputDir = new Stack<>();
       filesInInputDir.add(archivesDirectory);
-      List<File> problems = new ArrayList<File>();
-      Set<File> filesToRetry = new HashSet<File>();
+      List<File> problems = new ArrayList<>();
+      Set<File> filesToRetry = new HashSet<>();
       while (!filesInInputDir.isEmpty()) {
         File pop = filesInInputDir.pop();
         if (pop.isDirectory()) {
diff --git a/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java b/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java
index f2e3e6c..bc8244e 100644
--- a/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java
+++ b/src/main/java/org/torproject/collector/relaydescs/ArchiveWriter.java
@@ -62,20 +62,17 @@ public class ArchiveWriter extends CollecTorMain {
   private int storedMicrodescriptorsCounter = 0;
 
   private SortedMap<Long, SortedSet<String>> storedConsensuses =
-      new TreeMap<Long, SortedSet<String>>();
+      new TreeMap<>();
   private SortedMap<Long, SortedSet<String>> storedMicrodescConsensuses =
-      new TreeMap<Long, SortedSet<String>>();
-  private SortedMap<Long, Integer> expectedVotes =
-      new TreeMap<Long, Integer>();
-  private SortedMap<Long, SortedMap<String, SortedSet<String>>>
-      storedVotes =
-      new TreeMap<Long, SortedMap<String, SortedSet<String>>>();
+      new TreeMap<>();
+  private SortedMap<Long, Integer> expectedVotes = new TreeMap<>();
+  private SortedMap<Long, SortedMap<String, SortedSet<String>>> storedVotes =
+      new TreeMap<>();
   private SortedMap<Long, Map<String, String>> storedServerDescriptors =
-      new TreeMap<Long, Map<String, String>>();
+      new TreeMap<>();
   private SortedMap<Long, Set<String>> storedExtraInfoDescriptors =
-      new TreeMap<Long, Set<String>>();
-  private SortedMap<Long, Set<String>> storedMicrodescriptors =
-      new TreeMap<Long, Set<String>>();
+      new TreeMap<>();
+  private SortedMap<Long, Set<String>> storedMicrodescriptors = new TreeMap<>();
 
   private File storedServerDescriptorsFile;
   private File storedExtraInfoDescriptorsFile;
@@ -334,18 +331,17 @@ public class ArchiveWriter extends CollecTorMain {
     SimpleDateFormat dateTimeFormat =
         new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     dateTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
-    Map<String, String> knownServerDescriptors =
-        new HashMap<String, String>();
+    Map<String, String> knownServerDescriptors = new HashMap<>();
     for (Map<String, String> descriptors :
         this.storedServerDescriptors.values()) {
       knownServerDescriptors.putAll(descriptors);
     }
-    Set<String> knownExtraInfoDescriptors = new HashSet<String>();
+    Set<String> knownExtraInfoDescriptors = new HashSet<>();
     for (Set<String> descriptors :
         this.storedExtraInfoDescriptors.values()) {
       knownExtraInfoDescriptors.addAll(descriptors);
     }
-    Set<String> knownMicrodescriptors = new HashSet<String>();
+    Set<String> knownMicrodescriptors = new HashSet<>();
     for (Set<String> descriptors : this.storedMicrodescriptors.values()) {
       knownMicrodescriptors.addAll(descriptors);
     }
@@ -564,7 +560,7 @@ public class ArchiveWriter extends CollecTorMain {
     long cutOffMillis = System.currentTimeMillis()
         - 3L * 24L * 60L * 60L * 1000L;
     long cutOffMicroMillis = cutOffMillis - 27L * 24L * 60L * 60L * 1000L;
-    Stack<File> allFiles = new Stack<File>();
+    Stack<File> allFiles = new Stack<>();
     allFiles.add(new File(recentPathName, RELAY_DESCRIPTORS));
     while (!allFiles.isEmpty()) {
       File file = allFiles.pop();
diff --git a/src/main/java/org/torproject/collector/relaydescs/CachedRelayDescriptorReader.java b/src/main/java/org/torproject/collector/relaydescs/CachedRelayDescriptorReader.java
index 53b1e54..2fb9978 100644
--- a/src/main/java/org/torproject/collector/relaydescs/CachedRelayDescriptorReader.java
+++ b/src/main/java/org/torproject/collector/relaydescs/CachedRelayDescriptorReader.java
@@ -52,8 +52,8 @@ public class CachedRelayDescriptorReader {
 
     /* Read import history containing SHA-1 digests of previously parsed
      * statuses and descriptors, so that we can skip them in this run. */
-    Set<String> lastImportHistory = new HashSet<String>();
-    Set<String> currentImportHistory = new HashSet<String>();
+    Set<String> lastImportHistory = new HashSet<>();
+    Set<String> currentImportHistory = new HashSet<>();
     File importHistoryFile = new File(statsDirectory,
         "cacheddesc-import-history");
     if (importHistoryFile.exists()) {
@@ -81,8 +81,8 @@ public class CachedRelayDescriptorReader {
       }
       logger.debug("Reading " + cachedDescDir.getAbsolutePath()
           + " directory.");
-      SortedSet<File> cachedDescFiles = new TreeSet<File>();
-      Stack<File> files = new Stack<File>();
+      SortedSet<File> cachedDescFiles = new TreeSet<>();
+      Stack<File> files = new Stack<>();
       files.add(cachedDescDir);
       while (!files.isEmpty()) {
         File file = files.pop();
diff --git a/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java b/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java
index 5e7e86f..7c10379 100644
--- a/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java
+++ b/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java
@@ -49,7 +49,7 @@ public class ReferenceChecker {
 
   private long currentTimeMillis;
 
-  private SortedSet<Reference> references = new TreeSet<Reference>();
+  private SortedSet<Reference> references = new TreeSet<>();
 
   private static DateFormat dateTimeFormat;
 
@@ -285,7 +285,7 @@ public class ReferenceChecker {
   }
 
   private void dropStaleReferences() {
-    SortedSet<Reference> recentReferences = new TreeSet<Reference>();
+    SortedSet<Reference> recentReferences = new TreeSet<>();
     for (Reference reference : this.references) {
       if (this.currentTimeMillis <= reference.expiresAfterMillis) {
         recentReferences.add(reference);
@@ -295,12 +295,12 @@ public class ReferenceChecker {
   }
 
   private void checkReferences() {
-    Set<String> knownDescriptors = new HashSet<String>();
+    Set<String> knownDescriptors = new HashSet<>();
     for (Reference reference : this.references) {
       knownDescriptors.add(reference.referencing);
     }
     double totalMissingDescriptorsWeight = 0.0;
-    Set<String> missingDescriptors = new TreeSet<String>();
+    Set<String> missingDescriptors = new TreeSet<>();
     StringBuilder sb = new StringBuilder("Missing referenced "
         + "descriptors:");
     for (Reference reference : this.references) {
diff --git a/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorDownloader.java b/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorDownloader.java
index df1b367..685f2bb 100644
--- a/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorDownloader.java
+++ b/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorDownloader.java
@@ -337,9 +337,9 @@ public class RelayDescriptorDownloader {
     /* Read list of missing descriptors from disk and memorize those that
      * we are interested in and that are likely to be found on the
      * directory authorities. */
-    this.missingDescriptors = new TreeMap<String, String>();
-    this.microdescriptorKeys = new HashMap<String, Set<String>>();
-    this.missingMicrodescriptors = new HashSet<String>();
+    this.missingDescriptors = new TreeMap<>();
+    this.microdescriptorKeys = new HashMap<>();
+    this.missingMicrodescriptors = new HashSet<>();
     this.missingDescriptorsFile = new File(
         "stats/missing-relay-descriptors");
     if (this.missingDescriptorsFile.exists()) {
@@ -413,7 +413,7 @@ public class RelayDescriptorDownloader {
 
     /* Read list of directory authorities and when we last downloaded all
      * server and extra-info descriptors from them. */
-    this.lastDownloadedAllDescriptors = new HashMap<String, String>();
+    this.lastDownloadedAllDescriptors = new HashMap<>();
     this.lastDownloadedAllDescriptorsFile = new File(
         "stats/last-downloaded-all-descriptors");
     if (this.lastDownloadedAllDescriptorsFile.exists()) {
@@ -451,7 +451,7 @@ public class RelayDescriptorDownloader {
 
     /* Make a list of at most two directory authorities that we want to
      * download all server and extra-info descriptors from. */
-    this.downloadAllDescriptorsFromAuthorities = new HashSet<String>();
+    this.downloadAllDescriptorsFromAuthorities = new HashSet<>();
     for (String authority : this.authorities) {
       if (!this.lastDownloadedAllDescriptors.containsKey(authority)
           || this.lastDownloadedAllDescriptors.get(authority).compareTo(
@@ -464,7 +464,7 @@ public class RelayDescriptorDownloader {
     }
 
     /* Prepare statistics on this execution. */
-    this.requestsByAuthority = new HashMap<String, Integer>();
+    this.requestsByAuthority = new HashMap<>();
     for (String authority : this.authorities) {
       this.requestsByAuthority.put(authority, 0);
     }
@@ -720,7 +720,7 @@ public class RelayDescriptorDownloader {
         /* Next, try to download current votes that we're missing. */
         if (downloadCurrentVotes) {
           String voteKeyPrefix = "vote," + this.currentValidAfter;
-          SortedSet<String> fingerprints = new TreeSet<String>();
+          SortedSet<String> fingerprints = new TreeSet<>();
           for (Map.Entry<String, String> e :
               this.missingDescriptors.entrySet()) {
             if (e.getValue().equals("NA")
@@ -775,8 +775,7 @@ public class RelayDescriptorDownloader {
              * and combine the descriptor identifiers to a URL of up to
              * 96 server or extra-info descriptors or 92 microdescriptors
              * that we can download at once. */
-            SortedSet<String> descriptorIdentifiers =
-                new TreeSet<String>();
+            SortedSet<String> descriptorIdentifiers = new TreeSet<>();
             for (Map.Entry<String, String> e :
                 this.missingDescriptors.entrySet()) {
               if (e.getValue().equals("NA")
diff --git a/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorParser.java b/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorParser.java
index d71e1f8..7f4ab29 100644
--- a/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorParser.java
+++ b/src/main/java/org/torproject/collector/relaydescs/RelayDescriptorParser.java
@@ -101,11 +101,11 @@ public class RelayDescriptorParser {
         String dirSource = null;
         long validAfter = -1L;
         long dirKeyPublished = -1L;
-        SortedSet<String> dirSources = new TreeSet<String>();
-        SortedSet<String> serverDescriptors = new TreeSet<String>();
-        SortedSet<String> serverDescriptorDigests = new TreeSet<String>();
-        SortedSet<String> microdescriptorKeys = new TreeSet<String>();
-        SortedSet<String> microdescriptorDigests = new TreeSet<String>();
+        SortedSet<String> dirSources = new TreeSet<>();
+        SortedSet<String> serverDescriptors = new TreeSet<>();
+        SortedSet<String> serverDescriptorDigests = new TreeSet<>();
+        SortedSet<String> microdescriptorKeys = new TreeSet<>();
+        SortedSet<String> microdescriptorDigests = new TreeSet<>();
         StringBuilder certificateStringBuilder = null;
         String certificateString = null;
         String lastRelayIdentity = null;
diff --git a/src/main/java/org/torproject/collector/torperf/TorperfDownloader.java b/src/main/java/org/torproject/collector/torperf/TorperfDownloader.java
index 66f6e84..b09a6d6 100644
--- a/src/main/java/org/torproject/collector/torperf/TorperfDownloader.java
+++ b/src/main/java/org/torproject/collector/torperf/TorperfDownloader.java
@@ -84,8 +84,7 @@ public class TorperfDownloader extends CollecTorMain {
     this.cleanUpRsyncDirectory();
   }
 
-  SortedMap<String, String> lastMergedTimestamps =
-      new TreeMap<String, String>();
+  SortedMap<String, String> lastMergedTimestamps = new TreeMap<>();
 
   private void readLastMergedTimestamps() {
     if (!this.torperfLastMergedFile.exists()) {
@@ -408,8 +407,7 @@ public class TorperfDownloader extends CollecTorMain {
       }
 
       /* Write output line to .tpf file. */
-      SortedMap<String, String> keysAndValues =
-          new TreeMap<String, String>();
+      SortedMap<String, String> keysAndValues = new TreeMap<>();
       keysAndValues.put("SOURCE", source);
       keysAndValues.put("FILESIZE", String.valueOf(fileSize));
       if (extradata != null) {
@@ -450,7 +448,7 @@ public class TorperfDownloader extends CollecTorMain {
       return null;
     }
     if (this.dataTimestamps == null) {
-      this.dataTimestamps = new TreeMap<Integer, String>();
+      this.dataTimestamps = new TreeMap<>();
       this.dataTimestamps.put(0, "START");
       this.dataTimestamps.put(2, "SOCKET");
       this.dataTimestamps.put(4, "CONNECT");
@@ -470,7 +468,7 @@ public class TorperfDownloader extends CollecTorMain {
       this.dataTimestamps.put(35, "DATAPERC80");
       this.dataTimestamps.put(37, "DATAPERC90");
     }
-    SortedMap<String, String> data = new TreeMap<String, String>();
+    SortedMap<String, String> data = new TreeMap<>();
     try {
       for (Map.Entry<Integer, String> e : this.dataTimestamps.entrySet()) {
         int intKey = e.getKey();
@@ -494,7 +492,7 @@ public class TorperfDownloader extends CollecTorMain {
 
   private SortedMap<String, String> parseExtradataLine(String line) {
     String[] parts = line.split(" ");
-    SortedMap<String, String> extradata = new TreeMap<String, String>();
+    SortedMap<String, String> extradata = new TreeMap<>();
     String previousKey = null;
     for (String part : parts) {
       String[] keyAndValue = part.split("=", -1);
@@ -564,7 +562,7 @@ public class TorperfDownloader extends CollecTorMain {
 
   private void readTpfLinesToCache(String source, int fileSize,
       String startDate) throws IOException {
-    this.cachedTpfLines = new TreeMap<String, String>();
+    this.cachedTpfLines = new TreeMap<>();
     this.cachedSource = source;
     this.cachedFileSize = fileSize;
     this.cachedStartDate = startDate;
@@ -624,7 +622,7 @@ public class TorperfDownloader extends CollecTorMain {
   public void cleanUpRsyncDirectory() throws ConfigurationException {
     long cutOffMillis = System.currentTimeMillis()
         - 3L * 24L * 60L * 60L * 1000L;
-    Stack<File> allFiles = new Stack<File>();
+    Stack<File> allFiles = new Stack<>();
     allFiles.add(new File(config.getPath(Key.RecentPath).toFile(), TORPERF));
     while (!allFiles.isEmpty()) {
       File file = allFiles.pop();



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits