This commit is contained in:
Looly 2021-07-26 17:06:48 +08:00
parent dfbdb92d61
commit 6468a0446d
2 changed files with 8 additions and 2 deletions

View File

@ -1321,8 +1321,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
* @return 变更后的原数组
* @since 3.0.9
*/
public static <T> T[]
reverse(T[] array, final int startIndexInclusive, final int endIndexExclusive) {
public static <T> T[] reverse(T[] array, final int startIndexInclusive, final int endIndexExclusive) {
if (isEmpty(array)) {
return array;
}

View File

@ -409,6 +409,13 @@ public class ArrayUtilTest {
Assert.assertArrayEquals(new int[]{4,3,2,1}, reverse);
}
@Test
public void reverseTest2s(){
Object[] a = {"1",'2',"3",4};
final Object[] reverse = ArrayUtil.reverse(a);
Assert.assertArrayEquals(new Object[]{4,"3",'2',"1"}, reverse);
}
@Test
public void removeEmptyTest() {
String[] a = {"a", "b", "", null, " ", "c"};