@@ -3930,15 +3930,15 @@ public static String join(final boolean[] array, final char delimiter, final int
39303930 if (endIndex - startIndex <= 0 ) {
39313931 return EMPTY ;
39323932 }
3933-
3934- StringBuilder stringBuilder = new StringBuilder ();
3933+ final StringBuilder stringBuilder = new StringBuilder ();
39353934 for (int i = startIndex ; i < endIndex ; i ++) {
3936- stringBuilder .append (array [i ]);
3937- if (i != endIndex - 1 ) {
3938- stringBuilder .append (delimiter );
3939- }
3935+ stringBuilder
3936+ .append (array [i ])
3937+ .append (delimiter );
39403938 }
3941- return stringBuilder .toString ();
3939+ return stringBuilder
3940+ .deleteCharAt (stringBuilder .length () - 1 )
3941+ .toString ();
39423942 }
39433943
39443944 /**
@@ -4011,14 +4011,15 @@ public static String join(final byte[] array, final char delimiter, final int st
40114011 if (endIndex - startIndex <= 0 ) {
40124012 return EMPTY ;
40134013 }
4014- StringBuilder stringBuilder = new StringBuilder ();
4014+ final StringBuilder stringBuilder = new StringBuilder ();
40154015 for (int i = startIndex ; i < endIndex ; i ++) {
4016- stringBuilder .append (array [i ]);
4017- if (i != endIndex - 1 ) {
4018- stringBuilder .append (delimiter );
4019- }
4016+ stringBuilder
4017+ .append (array [i ])
4018+ .append (delimiter );
40204019 }
4021- return stringBuilder .toString ();
4020+ return stringBuilder
4021+ .deleteCharAt (stringBuilder .length () - 1 )
4022+ .toString ();
40224023 }
40234024
40244025 /**
@@ -4091,15 +4092,15 @@ public static String join(final char[] array, final char delimiter, final int st
40914092 if (endIndex - startIndex <= 0 ) {
40924093 return EMPTY ;
40934094 }
4094-
4095- StringBuilder stringBuilder = new StringBuilder ();
4095+ final StringBuilder stringBuilder = new StringBuilder ();
40964096 for (int i = startIndex ; i < endIndex ; i ++) {
4097- stringBuilder .append (array [i ]);
4098- if (i != endIndex - 1 ) {
4099- stringBuilder .append (delimiter );
4100- }
4097+ stringBuilder
4098+ .append (array [i ])
4099+ .append (delimiter );
41014100 }
4102- return stringBuilder .toString ();
4101+ return stringBuilder
4102+ .deleteCharAt (stringBuilder .length () - 1 )
4103+ .toString ();
41034104 }
41044105
41054106 /**
@@ -4174,12 +4175,13 @@ public static String join(final double[] array, final char delimiter, final int
41744175 }
41754176 final StringBuilder stringBuilder = new StringBuilder ();
41764177 for (int i = startIndex ; i < endIndex ; i ++) {
4177- stringBuilder .append (array [i ]);
4178- if (i != endIndex - 1 ) {
4179- stringBuilder .append (delimiter );
4180- }
4178+ stringBuilder
4179+ .append (array [i ])
4180+ .append (delimiter );
41814181 }
4182- return stringBuilder .toString ();
4182+ return stringBuilder
4183+ .deleteCharAt (stringBuilder .length () - 1 )
4184+ .toString ();
41834185 }
41844186
41854187 /**
@@ -4254,12 +4256,13 @@ public static String join(final float[] array, final char delimiter, final int s
42544256 }
42554257 final StringBuilder stringBuilder = new StringBuilder ();
42564258 for (int i = startIndex ; i < endIndex ; i ++) {
4257- stringBuilder .append (array [i ]);
4258- if (i != endIndex - 1 ) {
4259- stringBuilder .append (delimiter );
4260- }
4259+ stringBuilder
4260+ .append (array [i ])
4261+ .append (delimiter );
42614262 }
4262- return stringBuilder .toString ();
4263+ return stringBuilder
4264+ .deleteCharAt (stringBuilder .length () - 1 )
4265+ .toString ();
42634266 }
42644267
42654268 /**
@@ -4334,12 +4337,13 @@ public static String join(final int[] array, final char delimiter, final int sta
43344337 }
43354338 final StringBuilder stringBuilder = new StringBuilder ();
43364339 for (int i = startIndex ; i < endIndex ; i ++) {
4337- stringBuilder .append (array [i ]);
4338- if (i != endIndex - 1 ) {
4339- stringBuilder .append (delimiter );
4340- }
4340+ stringBuilder
4341+ .append (array [i ])
4342+ .append (delimiter );
43414343 }
4342- return stringBuilder .toString ();
4344+ return stringBuilder
4345+ .deleteCharAt (stringBuilder .length () - 1 )
4346+ .toString ();
43434347 }
43444348
43454349 /**
@@ -4623,12 +4627,13 @@ public static String join(final long[] array, final char delimiter, final int st
46234627 }
46244628 final StringBuilder stringBuilder = new StringBuilder ();
46254629 for (int i = startIndex ; i < endIndex ; i ++) {
4626- stringBuilder .append (array [i ]);
4627- if (i != endIndex - 1 ) {
4628- stringBuilder .append (delimiter );
4629- }
4630+ stringBuilder
4631+ .append (array [i ])
4632+ .append (delimiter );
46304633 }
4631- return stringBuilder .toString ();
4634+ return stringBuilder
4635+ .deleteCharAt (stringBuilder .length () - 1 )
4636+ .toString ();
46324637 }
46334638
46344639 /**
@@ -4841,12 +4846,13 @@ public static String join(final short[] array, final char delimiter, final int s
48414846 }
48424847 final StringBuilder stringBuilder = new StringBuilder ();
48434848 for (int i = startIndex ; i < endIndex ; i ++) {
4844- stringBuilder .append (array [i ]);
4845- if (i != endIndex - 1 ) {
4846- stringBuilder .append (delimiter );
4847- }
4849+ stringBuilder
4850+ .append (array [i ])
4851+ .append (delimiter );
48484852 }
4849- return stringBuilder .toString ();
4853+ return stringBuilder
4854+ .deleteCharAt (stringBuilder .length () - 1 )
4855+ .toString ();
48504856 }
48514857
48524858 /**
0 commit comments