@Test public void toSortedList() { ImmutableCollection<Integer> integers = this.classUnderTest(); MutableList<Integer> copy = FastList.newList(integers); MutableList<Integer> list = integers.toSortedList(Collections.<Integer>reverseOrder()); Assert.assertEquals(copy.sortThis(Collections.<Integer>reverseOrder()), list); MutableList<Integer> list2 = integers.toSortedList(); Assert.assertEquals(copy.sortThis(), list2); }
@Test public void toSortedSetWithComparator() { ImmutableCollection<Integer> integers = this.classUnderTest(); MutableSortedSet<Integer> set = integers.toSortedSet(Comparators.<Integer>reverseNaturalOrder()); Assert.assertEquals(integers.toSet(), set); Assert.assertEquals( integers.toSortedList(Comparators.<Integer>reverseNaturalOrder()), set.toList()); }
@Test public void toSortedSet() { ImmutableCollection<Integer> integers = this.classUnderTest(); MutableSortedSet<Integer> set = integers.toSortedSet(); Verify.assertListsEqual(integers.toSortedList(), set.toList()); }