adding java 8 null removal test
This commit is contained in:
parent
226e23b603
commit
7cd58457ec
|
@ -30,6 +30,14 @@ public class Java8CollectionCleanupUnitTest {
|
|||
assertThat(listWithoutNulls, hasSize(3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenListContainsNulls_whenRemovingNullsWithRemoveIf_thenCorrect() {
|
||||
final List<Integer> listWithoutNulls = Lists.newArrayList(null, 1, 2, null, 3, null);
|
||||
listWithoutNulls.removeIf(p -> p == null);
|
||||
|
||||
assertThat(listWithoutNulls, hasSize(3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenListContainsDuplicates_whenRemovingDuplicatesWithJava8_thenCorrect() {
|
||||
final List<Integer> listWithDuplicates = Lists.newArrayList(1, 1, 2, 2, 3, 3);
|
||||
|
|
Loading…
Reference in New Issue