public void testCopyOfSortedNatural() { SortedMap<String, Integer> original = Maps.newTreeMap(); original.put("one", 1); original.put("two", 2); original.put("three", 3); ImmutableSortedMap<String, Integer> copy = ImmutableSortedMap.copyOfSorted(original); assertMapEquals(copy, "one", 1, "three", 3, "two", 2); assertSame(copy, ImmutableSortedMap.copyOfSorted(copy)); assertSame(Ordering.natural(), copy.comparator()); }
public void testCopyOfSortedExplicit() { Comparator<String> comparator = Ordering.natural().reverse(); SortedMap<String, Integer> original = Maps.newTreeMap(comparator); original.put("one", 1); original.put("two", 2); original.put("three", 3); ImmutableSortedMap<String, Integer> copy = ImmutableSortedMap.copyOfSorted(original); assertMapEquals(copy, "two", 2, "three", 3, "one", 1); assertSame(copy, ImmutableSortedMap.copyOfSorted(copy)); assertSame(comparator, copy.comparator()); }
public ImmutableDruidDataSource( String name, Map<String, String> properties, SortedMap<String, DataSegment> idToSegments ) { this.name = Preconditions.checkNotNull(name); this.properties = ImmutableMap.copyOf(properties); this.idToSegments = ImmutableSortedMap.copyOfSorted(idToSegments); }
public ImmutableDruidDataSource( String name, Map<String, String> properties, SortedMap<String, DataSegment> idToSegments ) { this.name = Preconditions.checkNotNull(name); this.properties = ImmutableMap.copyOf(properties); this.idToSegments = ImmutableSortedMap.copyOfSorted(idToSegments); }
public IntervalSet<T> build() { return new IntervalSet<T>(ImmutableSortedMap.copyOfSorted(ranges)); } }
/** * Returns an immutable copy of the specified sorted {@code map}. * * @param map * the sorted map for which an immutable copy should be created. May not be <code>null</code>. * @return an immutable copy of the specified sorted map. */ @Inline(value="$2.$3copyOfSorted($1)", imported=ImmutableSortedMap.class) public static <K, V> SortedMap<K, V> immutableCopy(SortedMap<K, ? extends V> map) { return ImmutableSortedMap.copyOfSorted(map); }
public IntervalSet<T> build() { return new IntervalSet<T>(ImmutableSortedMap.copyOfSorted(ranges)); } }
/** * Returns an immutable copy of the specified sorted {@code map}. * * @param map * the sorted map for which an immutable copy should be created. May not be <code>null</code>. * @return an immutable copy of the specified sorted map. */ @Inline(value="$2.$3copyOfSorted($1)", imported=ImmutableSortedMap.class) public static <K, V> SortedMap<K, V> immutableCopy(SortedMap<K, ? extends V> map) { return ImmutableSortedMap.copyOfSorted(map); }
private TenorRawOptionData( SortedMap<Tenor, RawOptionData> data) { JodaBeanUtils.notNull(data, "data"); this.data = ImmutableSortedMap.copyOfSorted(data); }
public IntervalSet<T> build() { return new IntervalSet<T>(ImmutableSortedMap.copyOfSorted(ranges)); } }
/** * Creates a tree with the given id and contents, no questions asked. * <p> * Be careful when using this method instead of {@link #build()}. {@link #build()} will compute * the appropriate id for the tree given its contents as mandated by {@link HashObject}, whilst * this method will create the tree as given, even if the id is not the one that would result * from properly computing it. * * @param id * @param size * @param childTreeCount * @param trees * @param features * @param buckets * @return */ static RevTree create(final ObjectId id, final long size, final int childTreeCount, @Nullable ImmutableList<Node> trees, @Nullable ImmutableList<Node> features, @Nullable SortedMap<Integer, Bucket> buckets) { ImmutableSortedMap<Integer, Bucket> immutableBuckets = buckets == null ? null : ImmutableSortedMap.copyOfSorted(buckets); return RevTreeImpl.create(id, size, childTreeCount, trees, features, immutableBuckets); }
public InMemoryMetastoreCursor(SortedMap<String, Versioned<Value>> map, Set<String> fields, ScheduledExecutorService scheduler) { // copy an map for iterator to avoid concurrent modification problem. this.iter = ImmutableSortedMap.copyOfSorted(map).entrySet().iterator(); this.fields = fields; this.scheduler = scheduler; }
public IntervalSet<T> deserialize(DataInputPlus in) throws IOException { int count = in.readInt(); NavigableMap<T, T> ranges = new TreeMap<>(); for (int i = 0; i < count; ++i) ranges.put(pointSerializer.deserialize(in), pointSerializer.deserialize(in)); return new IntervalSet<T>(ImmutableSortedMap.copyOfSorted(ranges)); }
public IntervalSet<T> deserialize(DataInputPlus in) throws IOException { int count = in.readInt(); NavigableMap<T, T> ranges = new TreeMap<>(); for (int i = 0; i < count; ++i) ranges.put(pointSerializer.deserialize(in), pointSerializer.deserialize(in)); return new IntervalSet<T>(ImmutableSortedMap.copyOfSorted(ranges)); }
public IntervalSet<T> deserialize(DataInputPlus in) throws IOException { int count = in.readInt(); NavigableMap<T, T> ranges = new TreeMap<>(); for (int i = 0; i < count; ++i) ranges.put(pointSerializer.deserialize(in), pointSerializer.deserialize(in)); return new IntervalSet<T>(ImmutableSortedMap.copyOfSorted(ranges)); }
public void testCopyOfSortedNatural() { SortedMap<String, Integer> original = Maps.newTreeMap(); original.put("one", 1); original.put("two", 2); original.put("three", 3); ImmutableSortedMap<String, Integer> copy = ImmutableSortedMap.copyOfSorted(original); assertMapEquals(copy, "one", 1, "three", 3, "two", 2); assertSame(copy, ImmutableSortedMap.copyOfSorted(copy)); assertSame(Ordering.natural(), copy.comparator()); }
public void testCopyOfSortedExplicit() { Comparator<String> comparator = Ordering.natural().reverse(); SortedMap<String, Integer> original = Maps.newTreeMap(comparator); original.put("one", 1); original.put("two", 2); original.put("three", 3); ImmutableSortedMap<String, Integer> copy = ImmutableSortedMap.copyOfSorted(original); assertMapEquals(copy, "two", 2, "three", 3, "one", 1); assertSame(copy, ImmutableSortedMap.copyOfSorted(copy)); assertSame(comparator, copy.comparator()); }
this.byMethod = ImmutableSortedMap.copyOfSorted(byMethodBuilder); this.byYang = ImmutableMap.copyOf(byYangBuilder); this.byStreamClass = ImmutableMap.copyOf(byStreamClassBuilder);
this.cases = ImmutableSortedMap.copyOfSorted(casesInit);
private void updateExecution(final LazyTaskExecution previousExecution, LazyTaskExecution currentExecution, TaskInternal task, IncrementalTaskInputsInternal taskInputs, InputNormalizationStrategy normalizationStrategy) { final ImmutableSortedMap<String, FileCollectionSnapshot> outputFilesAfter = snapshotTaskFiles(task, "Output", normalizationStrategy, task.getOutputs().getFileProperties(), snapshotterRegistry); ImmutableSortedMap<String, FileCollectionSnapshot> newOutputSnapshot; if (currentExecution.getDetectedOverlappingOutputs() == null) { newOutputSnapshot = outputFilesAfter; } else { newOutputSnapshot = ImmutableSortedMap.copyOfSorted(Maps.transformEntries(currentExecution.getOutputFilesSnapshot(), new Maps.EntryTransformer<String, FileCollectionSnapshot, FileCollectionSnapshot>() { @Override public FileCollectionSnapshot transformEntry(String propertyName, FileCollectionSnapshot beforeExecution) { FileCollectionSnapshot afterExecution = outputFilesAfter.get(propertyName); FileCollectionSnapshot afterPreviousExecution = getSnapshotAfterPreviousExecution(previousExecution, propertyName); return filterOutputSnapshot(afterPreviousExecution, beforeExecution, afterExecution); } })); } updateExecution(currentExecution, task, taskInputs, newOutputSnapshot, normalizationStrategy); }