Skip to content

Commit 4b08ed5

Browse files
committed
Rename internal method to remove type casts
1 parent e7bf205 commit 4b08ed5

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/main/java/org/apache/commons/lang3/ArrayUtils.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5308,7 +5308,7 @@ public static long[] removeAll(final long[] array, final int... indices) {
53085308
* @return new array of same type minus elements specified by the set bits in {@code indices}.
53095309
*/
53105310
// package protected for access by unit tests
5311-
static Object removeAll(final Object array, final BitSet indices) {
5311+
static Object removeAt(final Object array, final BitSet indices) {
53125312
if (array == null) {
53135313
return null;
53145314
}
@@ -5475,7 +5475,7 @@ public static <T> T[] removeAll(final T[] array, final int... indices) {
54755475
*/
54765476
@Deprecated
54775477
public static boolean[] removeAllOccurences(final boolean[] array, final boolean element) {
5478-
return (boolean[]) removeAll((Object) array, indexesOf(array, element));
5478+
return (boolean[]) removeAt(array, indexesOf(array, element));
54795479
}
54805480

54815481
/**
@@ -5494,7 +5494,7 @@ public static boolean[] removeAllOccurences(final boolean[] array, final boolean
54945494
*/
54955495
@Deprecated
54965496
public static byte[] removeAllOccurences(final byte[] array, final byte element) {
5497-
return (byte[]) removeAll((Object) array, indexesOf(array, element));
5497+
return (byte[]) removeAt(array, indexesOf(array, element));
54985498
}
54995499

55005500
/**
@@ -5513,7 +5513,7 @@ public static byte[] removeAllOccurences(final byte[] array, final byte element)
55135513
*/
55145514
@Deprecated
55155515
public static char[] removeAllOccurences(final char[] array, final char element) {
5516-
return (char[]) removeAll((Object) array, indexesOf(array, element));
5516+
return (char[]) removeAt(array, indexesOf(array, element));
55175517
}
55185518

55195519
/**
@@ -5532,7 +5532,7 @@ public static char[] removeAllOccurences(final char[] array, final char element)
55325532
*/
55335533
@Deprecated
55345534
public static double[] removeAllOccurences(final double[] array, final double element) {
5535-
return (double[]) removeAll((Object) array, indexesOf(array, element));
5535+
return (double[]) removeAt(array, indexesOf(array, element));
55365536
}
55375537

55385538
/**
@@ -5551,7 +5551,7 @@ public static double[] removeAllOccurences(final double[] array, final double el
55515551
*/
55525552
@Deprecated
55535553
public static float[] removeAllOccurences(final float[] array, final float element) {
5554-
return (float[]) removeAll((Object) array, indexesOf(array, element));
5554+
return (float[]) removeAt(array, indexesOf(array, element));
55555555
}
55565556

55575557
/**
@@ -5570,7 +5570,7 @@ public static float[] removeAllOccurences(final float[] array, final float eleme
55705570
*/
55715571
@Deprecated
55725572
public static int[] removeAllOccurences(final int[] array, final int element) {
5573-
return (int[]) removeAll((Object) array, indexesOf(array, element));
5573+
return (int[]) removeAt(array, indexesOf(array, element));
55745574
}
55755575

55765576
/**
@@ -5589,7 +5589,7 @@ public static int[] removeAllOccurences(final int[] array, final int element) {
55895589
*/
55905590
@Deprecated
55915591
public static long[] removeAllOccurences(final long[] array, final long element) {
5592-
return (long[]) removeAll((Object) array, indexesOf(array, element));
5592+
return (long[]) removeAt(array, indexesOf(array, element));
55935593
}
55945594

55955595
/**
@@ -5608,7 +5608,7 @@ public static long[] removeAllOccurences(final long[] array, final long element)
56085608
*/
56095609
@Deprecated
56105610
public static short[] removeAllOccurences(final short[] array, final short element) {
5611-
return (short[]) removeAll((Object) array, indexesOf(array, element));
5611+
return (short[]) removeAt(array, indexesOf(array, element));
56125612
}
56135613

56145614
/**
@@ -5628,7 +5628,7 @@ public static short[] removeAllOccurences(final short[] array, final short eleme
56285628
*/
56295629
@Deprecated
56305630
public static <T> T[] removeAllOccurences(final T[] array, final T element) {
5631-
return (T[]) removeAll((Object) array, indexesOf(array, element));
5631+
return (T[]) removeAt(array, indexesOf(array, element));
56325632
}
56335633

56345634
/**
@@ -5645,7 +5645,7 @@ public static <T> T[] removeAllOccurences(final T[] array, final T element) {
56455645
* @since 3.10
56465646
*/
56475647
public static boolean[] removeAllOccurrences(final boolean[] array, final boolean element) {
5648-
return (boolean[]) removeAll((Object) array, indexesOf(array, element));
5648+
return (boolean[]) removeAt(array, indexesOf(array, element));
56495649
}
56505650

56515651
/**
@@ -5662,7 +5662,7 @@ public static boolean[] removeAllOccurrences(final boolean[] array, final boolea
56625662
* @since 3.10
56635663
*/
56645664
public static byte[] removeAllOccurrences(final byte[] array, final byte element) {
5665-
return (byte[]) removeAll((Object) array, indexesOf(array, element));
5665+
return (byte[]) removeAt(array, indexesOf(array, element));
56665666
}
56675667

56685668
/**
@@ -5679,7 +5679,7 @@ public static byte[] removeAllOccurrences(final byte[] array, final byte element
56795679
* @since 3.10
56805680
*/
56815681
public static char[] removeAllOccurrences(final char[] array, final char element) {
5682-
return (char[]) removeAll((Object) array, indexesOf(array, element));
5682+
return (char[]) removeAt(array, indexesOf(array, element));
56835683
}
56845684

56855685
/**
@@ -5696,7 +5696,7 @@ public static char[] removeAllOccurrences(final char[] array, final char element
56965696
* @since 3.10
56975697
*/
56985698
public static double[] removeAllOccurrences(final double[] array, final double element) {
5699-
return (double[]) removeAll((Object) array, indexesOf(array, element));
5699+
return (double[]) removeAt(array, indexesOf(array, element));
57005700
}
57015701

57025702
/**
@@ -5713,7 +5713,7 @@ public static double[] removeAllOccurrences(final double[] array, final double e
57135713
* @since 3.10
57145714
*/
57155715
public static float[] removeAllOccurrences(final float[] array, final float element) {
5716-
return (float[]) removeAll((Object) array, indexesOf(array, element));
5716+
return (float[]) removeAt(array, indexesOf(array, element));
57175717
}
57185718

57195719
/**
@@ -5730,7 +5730,7 @@ public static float[] removeAllOccurrences(final float[] array, final float elem
57305730
* @since 3.10
57315731
*/
57325732
public static int[] removeAllOccurrences(final int[] array, final int element) {
5733-
return (int[]) removeAll((Object) array, indexesOf(array, element));
5733+
return (int[]) removeAt(array, indexesOf(array, element));
57345734
}
57355735

57365736
/**
@@ -5747,7 +5747,7 @@ public static int[] removeAllOccurrences(final int[] array, final int element) {
57475747
* @since 3.10
57485748
*/
57495749
public static long[] removeAllOccurrences(final long[] array, final long element) {
5750-
return (long[]) removeAll((Object) array, indexesOf(array, element));
5750+
return (long[]) removeAt(array, indexesOf(array, element));
57515751
}
57525752

57535753
/**
@@ -5764,7 +5764,7 @@ public static long[] removeAllOccurrences(final long[] array, final long element
57645764
* @since 3.10
57655765
*/
57665766
public static short[] removeAllOccurrences(final short[] array, final short element) {
5767-
return (short[]) removeAll((Object) array, indexesOf(array, element));
5767+
return (short[]) removeAt(array, indexesOf(array, element));
57685768
}
57695769

57705770
/**
@@ -5782,7 +5782,7 @@ public static short[] removeAllOccurrences(final short[] array, final short elem
57825782
* @since 3.10
57835783
*/
57845784
public static <T> T[] removeAllOccurrences(final T[] array, final T element) {
5785-
return (T[]) removeAll((Object) array, indexesOf(array, element));
5785+
return (T[]) removeAt(array, indexesOf(array, element));
57865786
}
57875787

57885788
/**
@@ -6102,7 +6102,7 @@ public static boolean[] removeElements(final boolean[] array, final boolean... v
61026102
toRemove.set(i);
61036103
}
61046104
}
6105-
return (boolean[]) removeAll(array, toRemove);
6105+
return (boolean[]) removeAt(array, toRemove);
61066106
}
61076107

61086108
/**
@@ -6151,7 +6151,7 @@ public static byte[] removeElements(final byte[] array, final byte... values) {
61516151
toRemove.set(i);
61526152
}
61536153
}
6154-
return (byte[]) removeAll(array, toRemove);
6154+
return (byte[]) removeAt(array, toRemove);
61556155
}
61566156

61576157
/**
@@ -6200,7 +6200,7 @@ public static char[] removeElements(final char[] array, final char... values) {
62006200
toRemove.set(i);
62016201
}
62026202
}
6203-
return (char[]) removeAll(array, toRemove);
6203+
return (char[]) removeAt(array, toRemove);
62046204
}
62056205

62066206
/**
@@ -6249,7 +6249,7 @@ public static double[] removeElements(final double[] array, final double... valu
62496249
toRemove.set(i);
62506250
}
62516251
}
6252-
return (double[]) removeAll(array, toRemove);
6252+
return (double[]) removeAt(array, toRemove);
62536253
}
62546254

62556255
/**
@@ -6298,7 +6298,7 @@ public static float[] removeElements(final float[] array, final float... values)
62986298
toRemove.set(i);
62996299
}
63006300
}
6301-
return (float[]) removeAll(array, toRemove);
6301+
return (float[]) removeAt(array, toRemove);
63026302
}
63036303

63046304
/**
@@ -6347,7 +6347,7 @@ public static int[] removeElements(final int[] array, final int... values) {
63476347
toRemove.set(i);
63486348
}
63496349
}
6350-
return (int[]) removeAll(array, toRemove);
6350+
return (int[]) removeAt(array, toRemove);
63516351
}
63526352

63536353
/**
@@ -6396,7 +6396,7 @@ public static long[] removeElements(final long[] array, final long... values) {
63966396
toRemove.set(i);
63976397
}
63986398
}
6399-
return (long[]) removeAll(array, toRemove);
6399+
return (long[]) removeAt(array, toRemove);
64006400
}
64016401

64026402
/**
@@ -6445,7 +6445,7 @@ public static short[] removeElements(final short[] array, final short... values)
64456445
toRemove.set(i);
64466446
}
64476447
}
6448-
return (short[]) removeAll(array, toRemove);
6448+
return (short[]) removeAt(array, toRemove);
64496449
}
64506450

64516451
/**
@@ -6497,7 +6497,7 @@ public static <T> T[] removeElements(final T[] array, final T... values) {
64976497
}
64986498
}
64996499
@SuppressWarnings("unchecked") // removeAll() always creates an array of the same type as its input
6500-
final T[] result = (T[]) removeAll(array, toRemove);
6500+
final T[] result = (T[]) removeAt(array, toRemove);
65016501
return result;
65026502
}
65036503

src/test/java/org/apache/commons/lang3/HashSetvBitSetTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public int[] timeBitSetRemoveAll() {
8080
final BitSet toRemove = new BitSet();
8181
final int[] array = new int[100];
8282
toRemove.set(10, 20);
83-
return (int[]) ArrayUtils.removeAll(array, toRemove);
83+
return (int[]) ArrayUtils.removeAt(array, toRemove);
8484
}
8585

8686
@Benchmark

0 commit comments

Comments
 (0)