From 382eb1bc2d6fa01c6f6168f275eb34d72ae2abb0 Mon Sep 17 00:00:00 2001 From: Markus KARG Date: Sun, 22 Dec 2024 13:05:56 +0000 Subject: [PATCH] Performance: String+ operation is faster than explicit StringBuilder.append() method --- .../src/main/java/jakarta/ws/rs/core/Variant.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/jaxrs-api/src/main/java/jakarta/ws/rs/core/Variant.java b/jaxrs-api/src/main/java/jakarta/ws/rs/core/Variant.java index a5460bfe..663d7e4a 100644 --- a/jaxrs-api/src/main/java/jakarta/ws/rs/core/Variant.java +++ b/jaxrs-api/src/main/java/jakarta/ws/rs/core/Variant.java @@ -227,14 +227,13 @@ public boolean equals(final Object obj) { @Override public String toString() { - return new StringBuilder("Variant[mediaType=") - .append(mediaType) - .append(", language=") - .append(language) - .append(", encoding=") - .append(encoding) - .append(']') - .toString(); + return "Variant[mediaType=" + + mediaType + + ", language=" + + language + + ", encoding=" + + encoding + + ']'; } /**