Object readResolve() { return map.values(); }
Object readResolve() { return map.values(); }
public Iterable<ImmutableDruidDataSource> getDataSources() { return dataSources.values(); }
Object readResolve() { return map.values(); }
@Override public Collection<UnhashableObject> create(UnhashableObject[] elements) { ImmutableMap.Builder<Integer, UnhashableObject> builder = ImmutableMap.builder(); int key = 1; for (UnhashableObject value : elements) { builder.put(key++, value); } return builder.build().values(); } }
@Override public List<String> create(String[] elements) { ImmutableMap.Builder<Integer, String> builder = ImmutableMap.builder(); for (int i = 0; i < elements.length; i++) { builder.put(i, elements[i]); } return builder.build().values().asList(); } }
@GwtIncompatible // not present in emulated superclass @Override int copyIntoArray(Object[] dst, int offset) { for (ImmutableCollection<V> valueCollection : multimap.map.values()) { offset = valueCollection.copyIntoArray(dst, offset); } return offset; }
public ImmutableList<LayerConfiguration> getLayerConfigurations() { return layerConfigurationMap.values().asList(); }
@Override public boolean containsValue(@Nullable Object value) { return values().contains(value); }
@Override public Iterator<DataSegment> iterator() { return dataSources.values().stream().flatMap(dataSource -> dataSource.getSegments().stream()).iterator(); }
public ImmutableDruidServer toImmutableDruidServer() { ImmutableMap<String, ImmutableDruidDataSource> immutableDataSources = ImmutableMap.copyOf( Maps.transformValues(this.dataSources, DruidDataSource::toImmutableDruidDataSource) ); // Computing the size and the total number of segments using the resulting immutableDataSources rather that taking // currSize.get() and totalSegments.get() to avoid inconsistency: segments could be added and deleted while we are // running toImmutableDruidDataSource(). long size = immutableDataSources.values().stream().mapToLong(ImmutableDruidDataSource::getTotalSizeOfSegments).sum(); int totalSegments = immutableDataSources.values().stream().mapToInt(dataSource -> dataSource.getSegments().size()).sum(); return new ImmutableDruidServer(metadata, size, immutableDataSources, totalSegments); } }
@Override UnmodifiableIterator<V> valueIterator() { return new UnmodifiableIterator<V>() { Iterator<? extends ImmutableCollection<V>> valueCollectionItr = map.values().iterator(); Iterator<V> valueItr = Iterators.emptyIterator(); @Override public boolean hasNext() { return valueItr.hasNext() || valueCollectionItr.hasNext(); } @Override public V next() { if (!valueItr.hasNext()) { valueItr = valueCollectionItr.next().iterator(); } return valueItr.next(); } }; }
@Override public synchronized void close() throws BackendException { /* Copying the map is necessary to avoid ConcurrentModificationException. * The path to ConcurrentModificationException in the absence of a copy is * log.close() -> manager.closedLog(log) -> openLogs.remove(log.getName()). */ for (KCVSLog log : ImmutableMap.copyOf(openLogs).values()) log.close(); IOUtils.closeQuietly(serializer); }
@GwtIncompatible // not present in emulated superclass @Override int copyIntoArray(Object[] dst, int offset) { for (ImmutableCollection<V> valueCollection : multimap.map.values()) { offset = valueCollection.copyIntoArray(dst, offset); } return offset; }
@GwtIncompatible private static final class KeysSerializedForm implements Serializable { final ImmutableMultimap<?, ?> multimap; KeysSerializedForm(ImmutableMultimap<?, ?> multimap) { this.multimap = multimap; } Object readResolve() { return multimap.keys(); } }
public boolean reverify(Unifier unifier) { return MoreObjects.firstNonNull( new PlaceholderVerificationVisitor( Collections2.transform( placeholder().requiredParameters(), Functions.forMap(arguments())), arguments().values()) .scan(unifier.getBinding(placeholder().blockKey()), unifier), true); }
public boolean reverify(Unifier unifier) { return MoreObjects.firstNonNull( new PlaceholderVerificationVisitor( Collections2.transform( placeholder().requiredParameters(), Functions.forMap(arguments())), arguments().values()) .scan(unifier.getBinding(placeholder().exprKey()), unifier), true); }
@Test public void importsHaveUnderscores() { SourceExtraction.Imports imports = PostprocessingMachine.collectImports( LINES.join("package start;", "import b.PAYMENT_STATUS_TYPE;", "final class B {", "}")); check(imports.classes.values()).hasContentInAnyOrder("b.PAYMENT_STATUS_TYPE"); }