commit 438c8ee334f3ec16ec83fcc81ec72c39d971cab6 Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Aug 20 15:42:09 2018 +0200
Avoid manual array copies. --- .../torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java | 4 +--- .../java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java | 4 +--- .../org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java index bb14c28..904dc35 100644 --- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java @@ -285,9 +285,7 @@ public class RelayNetworkStatusConsensusImpl extends NetworkStatusImpl + "'."); } String[] knownFlags = new String[parts.length - 1]; - for (int i = 1; i < parts.length; i++) { - knownFlags[i - 1] = parts[i]; - } + System.arraycopy(parts, 1, knownFlags, 0, parts.length - 1); this.knownFlags = knownFlags; }
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java index 93c66de..11cc631 100644 --- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusImpl.java @@ -223,9 +223,7 @@ public class RelayNetworkStatusImpl extends NetworkStatusImpl
private void parseDirOptionsLine(String[] parts) { String[] dirOptions = new String[parts.length - 1]; - for (int i = 1; i < parts.length; i++) { - dirOptions[i - 1] = parts[i]; - } + System.arraycopy(parts, 1, dirOptions, 0, parts.length - 1); this.dirOptions = dirOptions; }
diff --git a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java index d686fa5..bb71842 100644 --- a/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java +++ b/src/main/java/org/torproject/descriptor/impl/RelayNetworkStatusVoteImpl.java @@ -355,9 +355,7 @@ public class RelayNetworkStatusVoteImpl extends NetworkStatusImpl + "'."); } String[] knownFlags = new String[parts.length - 1]; - for (int i = 1; i < parts.length; i++) { - knownFlags[i - 1] = parts[i]; - } + System.arraycopy(parts, 1, knownFlags, 0, parts.length - 1); this.knownFlags = knownFlags; }