@Test public void toSortedSet_with_comparator() { LazyIterable<Integer> integers = this.newWith(2, 4, 4, 2, 1, 4, 1, 3); MutableSortedSet<Integer> set = integers.toSortedSet(Collections.<Integer>reverseOrder()); Verify.assertSortedSetsEqual( TreeSortedSet.newSetWith(Collections.<Integer>reverseOrder(), 1, 2, 3, 4), set); }
@Test public void toSortedSetBy() { this.unmodifiableCollection = this.newWith("2", "4", "1", "3"); MutableSortedSet<String> set = this.unmodifiableCollection.toSortedSetBy(Functions.getStringToInteger()); Verify.assertSortedSetsEqual(TreeSortedSet.newSetWith("1", "2", "3", "4"), set); }
@Test public void toSortedSet_with_comparator() { this.unmodifiableCollection = this.newWith("2", "4", "4", "2", "1", "4", "1", "3"); MutableSortedSet<String> set = this.unmodifiableCollection.toSortedSet(Collections.<String>reverseOrder()); Verify.assertSortedSetsEqual( TreeSortedSet.newSetWith(Collections.<String>reverseOrder(), "1", "2", "3", "4"), set); }
public MutableSortedSet<T> toSortedSet(Comparator<? super T> comparator) { return TreeSortedSet.newSet(comparator, this); }
public MutableSortedSet<T> toSortedSet() { return TreeSortedSet.newSet(null, this); }
@Test public void toSortedSetBy() { ImmutableCollection<Integer> integers = this.classUnderTest(); MutableSortedSet<Integer> set = integers.toSortedSetBy(Functions.getToString()); Verify.assertSortedSetsEqual(TreeSortedSet.newSet(integers), set); }
public PartitionTreeSortedSet(Comparator<? super T> comparator, Predicate<? super T> predicate) { super(predicate); this.selected = TreeSortedSet.newSet(comparator); this.rejected = TreeSortedSet.newSet(comparator); }
@Test public void toSortedSetBy() { LazyIterable<Integer> integers = this.newWith(2, 4, 1, 3); MutableSortedSet<Integer> set = integers.toSortedSetBy(Functions.getToString()); Verify.assertSortedSetsEqual(TreeSortedSet.newSetWith(1, 2, 3, 4), set); }
@Test public void toSortedSet() { LazyIterable<Integer> integers = this.newWith(2, 4, 1, 3, 2, 1, 3, 4); MutableSortedSet<Integer> set = integers.toSortedSet(); Verify.assertSortedSetsEqual(TreeSortedSet.newSetWith(1, 2, 3, 4), set); }