Skip to content

Commit 4589860

Browse files
authored
BAEL-1090 Fixed minor issue with total time calculation (eugenp#2589)
1 parent 644ecbd commit 4589860

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

core-java-9/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void main(String[] args) {
1717
startTime = System.currentTimeMillis();
1818
String appended = (String) strings.stream().limit(100_000)
1919
.reduce("", (left, right) -> left.toString() + right.toString());
20-
totalTime = System.currentTimeMillis() - totalTime;
20+
totalTime = System.currentTimeMillis() - startTime;
2121
System.out.println("Created string of length " + appended.length()
2222
+ " in " + totalTime + " ms.");
2323
}

0 commit comments

Comments
 (0)