Metadata { public <T> boolean remove(Key<T> key, T value) { Preconditions.checkNotNull(key, "key"); Preconditions.checkNotNull(value, "value"); List<MetadataEntry> values = store.get(key.name()); if (values == null) { return false; } for (int i = 0; i < values.size(); i++) { MetadataEntry entry = values.get(i); if (!value.equals(entry.getParsed(key))) { continue; } values.remove(i); storeCount--; return true; } return false; } @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 removeIgnoresMissingValue() { Metadata m = new Metadata(); Key<String> key = GrpcUtil.USER_AGENT_KEY; boolean success = m.remove(key, "agent"); assertFalse(success); }