Skip to content

Commit

Permalink
BAEL-4493: Use the prefered Set.toArray() approach (eugenp#9837)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwoyke authored Aug 8, 2020
1 parent 15e94bb commit 87111ea
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public final void givenUsingCoreJavaV2_whenArrayConvertedToSet_thenCorrect() {
@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
Expand All @@ -94,16 +94,10 @@ public final void givenUsingCommonsCollections_whenArrayConvertedToSet_thenCorre
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);
}

Expand Down

0 comments on commit 87111ea

Please sign in to comment.