diff --git a/src/main/java/net/sf/jabref/logic/util/strings/StringUtil.java b/src/main/java/net/sf/jabref/logic/util/strings/StringUtil.java index 5723adb309a4..5db1e62071f8 100644 --- a/src/main/java/net/sf/jabref/logic/util/strings/StringUtil.java +++ b/src/main/java/net/sf/jabref/logic/util/strings/StringUtil.java @@ -16,13 +16,11 @@ package net.sf.jabref.logic.util.strings; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; import net.sf.jabref.Globals; import net.sf.jabref.model.entry.Author; @@ -648,15 +646,15 @@ public static String expandAuthorInitials(String name) { } for (int j = 1; j < names.length; j++) { if (j == 1) { - String innerNames = Arrays.stream(names[j].split(" ")) - .map(Author::addDotIfAbbreviation) - .collect(Collectors.joining(" ")); - sb.append(innerNames); - } + sb.append(Author.addDotIfAbbreviation(names[j])); + } else { + sb.append(names[j]); + } if (j < (names.length - 1)) { sb.append(", "); } } + } else { String[] names = authors[i].split(" "); if (names.length > 0) { @@ -671,6 +669,7 @@ public static String expandAuthorInitials(String name) { sb.append(" and "); } } + return sb.toString().trim(); }