@@ -3930,7 +3930,7 @@ public static String join(final boolean[] array, final char delimiter, final int
39303930 if (endIndex - startIndex <= 0 ) {
39313931 return EMPTY ;
39323932 }
3933- // Using StringBuilder for joining primitives
3933+
39343934 StringBuilder stringBuilder = new StringBuilder ();
39353935 for (int i = startIndex ; i < endIndex ; i ++) {
39363936 stringBuilder .append (array [i ]);
@@ -4011,11 +4011,14 @@ public static String join(final byte[] array, final char delimiter, final int st
40114011 if (endIndex - startIndex <= 0 ) {
40124012 return EMPTY ;
40134013 }
4014- final StringJoiner joiner = newStringJoiner ( delimiter );
4014+ StringBuilder stringBuilder = new StringBuilder ( );
40154015 for (int i = startIndex ; i < endIndex ; i ++) {
4016- joiner .add (String .valueOf (array [i ]));
4016+ stringBuilder .append (array [i ]);
4017+ if (i != endIndex - 1 ) {
4018+ stringBuilder .append (delimiter );
4019+ }
40174020 }
4018- return joiner .toString ();
4021+ return stringBuilder .toString ();
40194022 }
40204023
40214024 /**
@@ -4088,11 +4091,15 @@ public static String join(final char[] array, final char delimiter, final int st
40884091 if (endIndex - startIndex <= 0 ) {
40894092 return EMPTY ;
40904093 }
4091- final StringJoiner joiner = newStringJoiner (delimiter );
4094+
4095+ StringBuilder stringBuilder = new StringBuilder ();
40924096 for (int i = startIndex ; i < endIndex ; i ++) {
4093- joiner .add (String .valueOf (array [i ]));
4097+ stringBuilder .append (array [i ]);
4098+ if (i != endIndex - 1 ) {
4099+ stringBuilder .append (delimiter );
4100+ }
40944101 }
4095- return joiner .toString ();
4102+ return stringBuilder .toString ();
40964103 }
40974104
40984105 /**
@@ -4165,11 +4172,14 @@ public static String join(final double[] array, final char delimiter, final int
41654172 if (endIndex - startIndex <= 0 ) {
41664173 return EMPTY ;
41674174 }
4168- final StringJoiner joiner = newStringJoiner ( delimiter );
4175+ final StringBuilder stringBuilder = new StringBuilder ( );
41694176 for (int i = startIndex ; i < endIndex ; i ++) {
4170- joiner .add (String .valueOf (array [i ]));
4177+ stringBuilder .append (array [i ]);
4178+ if (i != endIndex - 1 ) {
4179+ stringBuilder .append (delimiter );
4180+ }
41714181 }
4172- return joiner .toString ();
4182+ return stringBuilder .toString ();
41734183 }
41744184
41754185 /**
@@ -4242,11 +4252,14 @@ public static String join(final float[] array, final char delimiter, final int s
42424252 if (endIndex - startIndex <= 0 ) {
42434253 return EMPTY ;
42444254 }
4245- final StringJoiner joiner = newStringJoiner ( delimiter );
4255+ final StringBuilder stringBuilder = new StringBuilder ( );
42464256 for (int i = startIndex ; i < endIndex ; i ++) {
4247- joiner .add (String .valueOf (array [i ]));
4257+ stringBuilder .append (array [i ]);
4258+ if (i != endIndex - 1 ) {
4259+ stringBuilder .append (delimiter );
4260+ }
42484261 }
4249- return joiner .toString ();
4262+ return stringBuilder .toString ();
42504263 }
42514264
42524265 /**
@@ -4319,11 +4332,14 @@ public static String join(final int[] array, final char delimiter, final int sta
43194332 if (endIndex - startIndex <= 0 ) {
43204333 return EMPTY ;
43214334 }
4322- final StringJoiner joiner = newStringJoiner ( delimiter );
4335+ final StringBuilder stringBuilder = new StringBuilder ( );
43234336 for (int i = startIndex ; i < endIndex ; i ++) {
4324- joiner .add (String .valueOf (array [i ]));
4337+ stringBuilder .append (array [i ]);
4338+ if (i != endIndex - 1 ) {
4339+ stringBuilder .append (delimiter );
4340+ }
43254341 }
4326- return joiner .toString ();
4342+ return stringBuilder .toString ();
43274343 }
43284344
43294345 /**
@@ -4605,11 +4621,14 @@ public static String join(final long[] array, final char delimiter, final int st
46054621 if (endIndex - startIndex <= 0 ) {
46064622 return EMPTY ;
46074623 }
4608- final StringJoiner joiner = newStringJoiner ( delimiter );
4624+ final StringBuilder stringBuilder = new StringBuilder ( );
46094625 for (int i = startIndex ; i < endIndex ; i ++) {
4610- joiner .add (String .valueOf (array [i ]));
4626+ stringBuilder .append (array [i ]);
4627+ if (i != endIndex - 1 ) {
4628+ stringBuilder .append (delimiter );
4629+ }
46114630 }
4612- return joiner .toString ();
4631+ return stringBuilder .toString ();
46134632 }
46144633
46154634 /**
@@ -4668,17 +4687,7 @@ public static String join(final Object[] array, final char delimiter) {
46684687 * @since 2.0
46694688 */
46704689 public static String join (final Object [] array , final char delimiter , final int startIndex , final int endIndex ) {
4671- if (array == null ) {
4672- return null ;
4673- }
4674- if (endIndex - startIndex <= 0 ) {
4675- return EMPTY ;
4676- }
4677- final StringJoiner joiner = newStringJoiner (delimiter );
4678- for (int i = startIndex ; i < endIndex ; i ++) {
4679- joiner .add (toStringOrEmpty (array [i ]));
4680- }
4681- return joiner .toString ();
4690+ return join (array , String .valueOf (delimiter ), startIndex , endIndex );
46824691 }
46834692
46844693 /**
@@ -4830,11 +4839,14 @@ public static String join(final short[] array, final char delimiter, final int s
48304839 if (endIndex - startIndex <= 0 ) {
48314840 return EMPTY ;
48324841 }
4833- final StringJoiner joiner = newStringJoiner ( delimiter );
4842+ final StringBuilder stringBuilder = new StringBuilder ( );
48344843 for (int i = startIndex ; i < endIndex ; i ++) {
4835- joiner .add (String .valueOf (array [i ]));
4844+ stringBuilder .append (array [i ]);
4845+ if (i != endIndex - 1 ) {
4846+ stringBuilder .append (delimiter );
4847+ }
48364848 }
4837- return joiner .toString ();
4849+ return stringBuilder .toString ();
48384850 }
48394851
48404852 /**
@@ -5526,10 +5538,6 @@ public static String mid(final String str, int pos, final int len) {
55265538 return str .substring (pos , pos + len );
55275539 }
55285540
5529- private static StringJoiner newStringJoiner (final char delimiter ) {
5530- return new StringJoiner (String .valueOf (delimiter ));
5531- }
5532-
55335541 /**
55345542 * <p>
55355543 * Similar to <a
0 commit comments