Metadata { public <T> Iterable<T> removeAll(final Key<T> key) { List<MetadataEntry> values = store.remove(key.name()); if (values == null) { return null; } storeCount -= values.size(); return Iterables.transform(values, new Function<MetadataEntry, T>() { @Override public T apply(MetadataEntry metadataEntry) { return metadataEntry.getParsed(key); } }); } @Internal  Metadata(byte[]... binaryValues);  Metadata(); @Internal int headerCount(); boolean containsKey(Key<?> key); T get(Key<T> key); Iterable<T> getAll(final Key<T> key); Set<String> keys(); void put(Key<T> key, T value); boolean remove(Key<T> key, T value); Iterable<T> removeAll(final Key<T> key); @Internal byte[][] serialize(); void merge(Metadata other); void merge(Metadata other, Set<Key<?>> keys); @Override String toString(); static final String BINARY_HEADER_SUFFIX; static final BinaryMarshaller<byte[]> BINARY_BYTE_MARSHALLER; static final AsciiMarshaller<String> ASCII_STRING_MARSHALLER; }
@Test public void removeAllIgnoresMissingValue() { Metadata m = new Metadata(); Key<String> key = GrpcUtil.USER_AGENT_KEY; Iterable<String> removed = m.removeAll(key); assertNull(removed); }