Reformat code

This commit is contained in:
Grzegorz Piwowarek 2016-09-12 22:02:51 +02:00
parent 0c12104b83
commit d9a7757602

View File

@ -19,9 +19,9 @@ public class ArrayListTest {
@Before @Before
public void setUp() { public void setUp() {
List<String> xs = LongStream.range(0, 16) List<String> xs = LongStream.range(0, 16)
.boxed() .boxed()
.map(Long::toHexString) .map(Long::toHexString)
.collect(toCollection(ArrayList::new)); .collect(toCollection(ArrayList::new));
stringsToSearch = new ArrayList<>(xs); stringsToSearch = new ArrayList<>(xs);
stringsToSearch.addAll(xs); stringsToSearch.addAll(xs);
} }
@ -35,7 +35,7 @@ public class ArrayListTest {
@Test @Test
public void givenCollection_whenProvideItToArrayListCtor_thenArrayListIsPopulatedWithItsElements() { public void givenCollection_whenProvideItToArrayListCtor_thenArrayListIsPopulatedWithItsElements() {
Collection<Integer> numbers = Collection<Integer> numbers =
IntStream.range(0, 10).boxed().collect(toSet()); IntStream.range(0, 10).boxed().collect(toSet());
List<Integer> xs = new ArrayList<>(numbers); List<Integer> xs = new ArrayList<>(numbers);
assertEquals(10, xs.size()); assertEquals(10, xs.size());
@ -57,7 +57,7 @@ public class ArrayListTest {
public void givenCollection_whenAddToArrayList_thenIsAdded() { public void givenCollection_whenAddToArrayList_thenIsAdded() {
List<Long> xs = new ArrayList<>(Arrays.asList(1L, 2L, 3L)); List<Long> xs = new ArrayList<>(Arrays.asList(1L, 2L, 3L));
LongStream.range(4, 10).boxed() LongStream.range(4, 10).boxed()
.collect(collectingAndThen(toList(), ys -> xs.addAll(0, ys))); .collect(collectingAndThen(toCollection(ArrayList::new), ys -> xs.addAll(0, ys)));
assertThat(Arrays.asList(4L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L), equalTo(xs)); assertThat(Arrays.asList(4L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L), equalTo(xs));
} }
@ -89,9 +89,9 @@ public class ArrayListTest {
Set<String> matchingStrings = new HashSet<>(Arrays.asList("a", "c", "9")); Set<String> matchingStrings = new HashSet<>(Arrays.asList("a", "c", "9"));
List<String> result = stringsToSearch List<String> result = stringsToSearch
.stream() .stream()
.filter(matchingStrings::contains) .filter(matchingStrings::contains)
.collect(toCollection(ArrayList::new)); .collect(toCollection(ArrayList::new));
assertEquals(6, result.size()); assertEquals(6, result.size());
} }
@ -132,7 +132,7 @@ public class ArrayListTest {
@Test @Test
public void givenCondition_whenIterateArrayList_thenRemoveAllElementsSatisfyingCondition() { public void givenCondition_whenIterateArrayList_thenRemoveAllElementsSatisfyingCondition() {
Set<String> matchingStrings Set<String> matchingStrings
= Sets.newHashSet("a", "b", "c", "d", "e", "f"); = Sets.newHashSet("a", "b", "c", "d", "e", "f");
Iterator<String> it = stringsToSearch.iterator(); Iterator<String> it = stringsToSearch.iterator();
while (it.hasNext()) { while (it.hasNext()) {