Refactor rename the variable name from 'clss' to 'clazz' (#1087)

This commit is contained in:
徐梦旗 2023-07-29 01:39:07 +08:00 committed by GitHub
parent 9b8c8af570
commit e208744651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -643,15 +643,15 @@ public class ArrayUtils {
* @param array the array to add the element to, may be {@code null}
* @param index the position of the new object
* @param element the object to add
* @param clss the type of the element being added
* @param clazz the type of the element being added
* @return A new array containing the existing elements and the new element
*/
private static Object add(final Object array, final int index, final Object element, final Class<?> clss) {
private static Object add(final Object array, final int index, final Object element, final Class<?> clazz) {
if (array == null) {
if (index != 0) {
throw new IndexOutOfBoundsException("Index: " + index + ", Length: 0");
}
final Object joinedArray = Array.newInstance(clss, 1);
final Object joinedArray = Array.newInstance(clazz, 1);
Array.set(joinedArray, 0, element);
return joinedArray;
}
@ -659,7 +659,7 @@ public class ArrayUtils {
if (index > length || index < 0) {
throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length);
}
final Object result = Array.newInstance(clss, length + 1);
final Object result = Array.newInstance(clazz, length + 1);
System.arraycopy(array, 0, result, 0, index);
Array.set(result, index, element);
if (index < length) {
@ -767,15 +767,15 @@ public class ArrayUtils {
*/
@Deprecated
public static <T> T[] add(final T[] array, final int index, final T element) {
final Class<T> clss;
final Class<T> clazz;
if (array != null) {
clss = getComponentType(array);
clazz = getComponentType(array);
} else if (element != null) {
clss = ObjectUtils.getClass(element);
clazz = ObjectUtils.getClass(element);
} else {
throw new IllegalArgumentException("Array and element cannot both be null");
}
return (T[]) add(array, index, element, clss);
return (T[]) add(array, index, element, clazz);
}