@Override public int size() { return headers.size(); }
@Override public Set<K> names() { if (isEmpty()) { return Collections.emptySet(); } Set<K> names = new LinkedHashSet<K>(size()); HeaderEntry<K, V> e = head.after; while (e != head) { names.add(e.getKey()); e = e.after; } return names; }
@Override public String toString() { return HeadersUtils.toString(getClass(), iterator(), size()); }
@Override public Set<K> names() { if (isEmpty()) { return Collections.emptySet(); } Set<K> names = new LinkedHashSet<K>(size()); HeaderEntry<K, V> e = head.after; while (e != head) { names.add(e.getKey()); e = e.after; } return names; }
@Override public List<Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Entry<String, String>> entriesConverted = new ArrayList<Entry<String, String>>( headers.size()); for (Entry<String, String> entry : this) { entriesConverted.add(entry); } return entriesConverted; }
@Override public String toString() { return HeadersUtils.toString(getClass(), iterator(), size()); }
@Override public Set<K> names() { if (isEmpty()) { return Collections.emptySet(); } Set<K> names = new LinkedHashSet<K>(size()); HeaderEntry<K, V> e = head.after; while (e != head) { names.add(e.getKey()); e = e.after; } return names; }
@Override public String toString() { return HeadersUtils.toString(getClass(), iterator(), size()); }
/** * Test this object for equality against {@code h2}. * @param h2 The object to check equality for. * @param valueHashingStrategy Defines how values will be compared for equality. * @return {@code true} if this object equals {@code h2} given {@code valueHashingStrategy}. * {@code false} otherwise. */ public final boolean equals(Headers<K, V, ?> h2, HashingStrategy<V> valueHashingStrategy) { if (h2.size() != size()) { return false; } if (this == h2) { return true; } for (K name : names()) { List<V> otherValues = h2.getAll(name); List<V> values = getAll(name); if (otherValues.size() != values.size()) { return false; } for (int i = 0; i < otherValues.size(); i++) { if (!valueHashingStrategy.equals(otherValues.get(i), values.get(i))) { return false; } } } return true; }
/** * Test this object for equality against {@code h2}. * @param h2 The object to check equality for. * @param valueHashingStrategy Defines how values will be compared for equality. * @return {@code true} if this object equals {@code h2} given {@code valueHashingStrategy}. * {@code false} otherwise. */ public final boolean equals(Headers<K, V, ?> h2, HashingStrategy<V> valueHashingStrategy) { if (h2.size() != size()) { return false; } if (this == h2) { return true; } for (K name : names()) { List<V> otherValues = h2.getAll(name); List<V> values = getAll(name); if (otherValues.size() != values.size()) { return false; } for (int i = 0; i < otherValues.size(); i++) { if (!valueHashingStrategy.equals(otherValues.get(i), values.get(i))) { return false; } } } return true; }
/** * Test this object for equality against {@code h2}. * @param h2 The object to check equality for. * @param valueHashingStrategy Defines how values will be compared for equality. * @return {@code true} if this object equals {@code h2} given {@code valueHashingStrategy}. * {@code false} otherwise. */ public final boolean equals(Headers<K, V, ?> h2, HashingStrategy<V> valueHashingStrategy) { if (h2.size() != size()) { return false; } if (this == h2) { return true; } for (K name : names()) { List<V> otherValues = h2.getAll(name); List<V> values = getAll(name); if (otherValues.size() != values.size()) { return false; } for (int i = 0; i < otherValues.size(); i++) { if (!valueHashingStrategy.equals(otherValues.get(i), values.get(i))) { return false; } } } return true; }
@Override public int size() { return headers.size(); }
@Override public int size() { return headers.size(); }
@Override public int size() { return headers.size(); }
@Override public List<Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Entry<String, String>> entriesConverted = new ArrayList<Entry<String, String>>( headers.size()); for (Entry<String, String> entry : this) { entriesConverted.add(entry); } return entriesConverted; }
@Override public List<Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Entry<String, String>> entriesConverted = new ArrayList<Entry<String, String>>( headers.size()); for (Entry<String, String> entry : this) { entriesConverted.add(entry); } return entriesConverted; }
@Override public List<Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Entry<String, String>> entriesConverted = new ArrayList<Entry<String, String>>( headers.size()); for (Entry<String, String> entry : this) { entriesConverted.add(entry); } return entriesConverted; }
@Override public Set<K> names() { if (isEmpty()) { return Collections.emptySet(); } Set<K> names = new LinkedHashSet<K>(size()); HeaderEntry<K, V> e = head.after; while (e != head) { names.add(e.getKey()); e = e.after; } return names; }
@Override public Set<K> names() { if (isEmpty()) { return Collections.emptySet(); } Set<K> names = new LinkedHashSet<K>(size()); HeaderEntry<K, V> e = head.after; while (e != head) { names.add(e.getKey()); e = e.after; } return names; }
@Override public String toString() { return HeadersUtils.toString(getClass(), iterator(), size()); }