commit 2457eb5be72d508c4ec4e2d2c3b6f7a88c69ed4c Author: iwakeh iwakeh@torproject.org Date: Fri Oct 27 17:35:15 2017 +0000
Use Java8 idiom for toString method. --- .../org/torproject/collector/bridgedescs/DescriptorBuilder.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/torproject/collector/bridgedescs/DescriptorBuilder.java b/src/main/java/org/torproject/collector/bridgedescs/DescriptorBuilder.java index cc57662..4ca9dd1 100644 --- a/src/main/java/org/torproject/collector/bridgedescs/DescriptorBuilder.java +++ b/src/main/java/org/torproject/collector/bridgedescs/DescriptorBuilder.java @@ -5,6 +5,7 @@ package org.torproject.collector.bridgedescs;
import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors;
/** Builder for descriptors. * @@ -55,10 +56,7 @@ class DescriptorBuilder {
@Override public String toString() { - StringBuilder full = new StringBuilder(); - for (Object part : this.parts) { - full.append(part.toString()); - } - return full.toString(); + return this.parts.stream().map(part -> part.toString()) + .collect(Collectors.joining("")); } }
tor-commits@lists.torproject.org