BAEL-4493: Use the prefered Set.toArray() approach (#9837)
This commit is contained in:
parent
15e94bb577
commit
87111ea998
|
@ -72,7 +72,7 @@ public class JavaCollectionConversionUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public final void givenUsingCoreJava_whenSetConvertedToArray_thenCorrect() {
|
public final void givenUsingCoreJava_whenSetConvertedToArray_thenCorrect() {
|
||||||
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
||||||
final Integer[] targetArray = sourceSet.toArray(new Integer[sourceSet.size()]);
|
final Integer[] targetArray = sourceSet.toArray(new Integer[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -94,16 +94,10 @@ public class JavaCollectionConversionUnitTest {
|
||||||
CollectionUtils.addAll(targetSet, sourceArray);
|
CollectionUtils.addAll(targetSet, sourceArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public final void givenUsingCommonsCollections_whenSetConvertedToArray_thenCorrect() {
|
|
||||||
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
|
||||||
final Integer[] targetArray = sourceSet.toArray(new Integer[sourceSet.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void givenUsingCommonsCollections_whenSetConvertedToArrayOfPrimitives_thenCorrect() {
|
public final void givenUsingCommonsCollections_whenSetConvertedToArrayOfPrimitives_thenCorrect() {
|
||||||
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
final Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
|
||||||
final Integer[] targetArray = sourceSet.toArray(new Integer[sourceSet.size()]);
|
final Integer[] targetArray = sourceSet.toArray(new Integer[0]);
|
||||||
final int[] primitiveTargetArray = ArrayUtils.toPrimitive(targetArray);
|
final int[] primitiveTargetArray = ArrayUtils.toPrimitive(targetArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue