BAEL-4493: Use the prefered Set.toArray() approach (#9837)

This commit is contained in:
kwoyke 2020-08-08 22:41:01 +02:00 committed by GitHub
parent 15e94bb577
commit 87111ea998
1 changed files with 2 additions and 8 deletions

View File

@ -72,7 +72,7 @@ public class JavaCollectionConversionUnitTest {
@Test
public final void givenUsingCoreJava_whenSetConvertedToArray_thenCorrect() {
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
@ -94,16 +94,10 @@ public class JavaCollectionConversionUnitTest {
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
public final void givenUsingCommonsCollections_whenSetConvertedToArrayOfPrimitives_thenCorrect() {
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);
}