public void testCopyOfSorted_natural_comparator() { SortedSet<String> input = Sets.newTreeSet(asList("in", "the", "quick", "jumped", "over", "a")); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); assertSame(Ordering.natural(), set.comparator()); }
public void testCopyOfSorted_natural_ordering() { SortedSet<String> input = Sets.newTreeSet(asList("in", "the", "quick", "jumped", "over", "a")); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); assertThat(set).containsExactly("a", "in", "jumped", "over", "quick", "the").inOrder(); }
public void testCopyOfSorted_explicit_ordering() { SortedSet<String> input = Sets.newTreeSet(STRING_LENGTH); Collections.addAll(input, "in", "the", "quick", "jumped", "over", "a"); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); assertThat(set).containsExactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertSame(STRING_LENGTH, set.comparator()); }
/** * Returns an immutable copy of the specified sorted {@code set}. * * @param set * the sorted set for which an immutable copy should be created. May not be <code>null</code>. * @return an immutable copy of the specified sorted set. */ @Inline(value="$2.$3copyOfSorted($1)", imported=ImmutableSortedSet.class) public static <T> SortedSet<T> immutableCopy(SortedSet<T> set) { return ImmutableSortedSet.copyOfSorted(set); }
/** * Returns an immutable copy of the specified sorted {@code set}. * * @param set * the sorted set for which an immutable copy should be created. May not be <code>null</code>. * @return an immutable copy of the specified sorted set. */ @Inline(value="$2.$3copyOfSorted($1)", imported=ImmutableSortedSet.class) public static <T> SortedSet<T> immutableCopy(SortedSet<T> set) { return ImmutableSortedSet.copyOfSorted(set); }
private MultiCurrencyAmount( SortedSet<CurrencyAmount> amounts) { JodaBeanUtils.notNull(amounts, "amounts"); this.amounts = ImmutableSortedSet.copyOfSorted(amounts); validate(); }
return ImmutableSortedSet.copyOfSorted(registry);
public void testCopyOfSorted_natural_comparator() { SortedSet<String> input = Sets.newTreeSet(asList("in", "the", "quick", "jumped", "over", "a")); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); assertSame(Ordering.natural(), set.comparator()); }
private static ImmutableTable<RendererEndpointKey, PeerEndpointKey, ImmutableSortedSet<RendererResolvedPolicy>> resolvePolicy( List<RendererEndpoint> rendererEps, Map<RuleGroupKey, ResolvedRuleGroup> ruleGroupInfoByRuleGroupKey) { Builder<RendererEndpointKey, PeerEndpointKey, ImmutableSortedSet<RendererResolvedPolicy>> resultBuilder = new Builder<>(); Supplier<TreeSet<RendererResolvedPolicy>> rendererPolicySupplier = () -> new TreeSet<>(); rendererEps.stream().forEach(rEp -> { rEp.getPeerEndpoint().stream().filter(Objects::nonNull).forEach(peer -> { ImmutableSortedSet<RendererResolvedPolicy> rPolicy = peer.getRuleGroupWithRendererEndpointParticipation() .stream() .map(ruleGroup -> new RendererResolvedPolicy(ruleGroup.getRendererEndpointParticipation(), ruleGroupInfoByRuleGroupKey.get(KeyFactory.ruleGroupKey(ruleGroup.getKey())))) .collect(Collectors.collectingAndThen(Collectors.toCollection(rendererPolicySupplier), ImmutableSortedSet::copyOfSorted)); resultBuilder.put(rEp.getKey(), KeyFactory.peerEndpointKey(peer.getKey()), ImmutableSortedSet.copyOfSorted(rPolicy)); }); }); return resultBuilder.build(); }
public void testCopyOfSorted_natural_ordering() { SortedSet<String> input = Sets.newTreeSet( asList("in", "the", "quick", "jumped", "over", "a")); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); assertThat(set).containsExactly("a", "in", "jumped", "over", "quick", "the").inOrder(); }
public void testCopyOfSorted_explicit_ordering() { SortedSet<String> input = Sets.newTreeSet(STRING_LENGTH); Collections.addAll(input, "in", "the", "quick", "jumped", "over", "a"); SortedSet<String> set = ImmutableSortedSet.copyOfSorted(input); assertThat(set).containsExactly("a", "in", "the", "over", "quick", "jumped").inOrder(); assertSame(STRING_LENGTH, set.comparator()); }