@Test public void entries() { ReadOnlyHttpHeaders headers = new ReadOnlyHttpHeaders(true, ACCEPT, APPLICATION_JSON, CONTENT_LENGTH, ZERO, CONNECTION, CLOSE); assertFalse(headers.isEmpty()); assertEquals(3, headers.size()); assert3ParisEquals(headers.entries().iterator()); }
@Override public List<Map.Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Map.Entry<String, String>> entries = new ArrayList<Map.Entry<String, String>>(size()); for (int i = 0; i < nameValuePairs.length; i += 2) { entries.add(new SimpleImmutableEntry<String, String>(nameValuePairs[i].toString(), nameValuePairs[i + 1].toString())); } return entries; }
ReadOnlyHttpHeaders extends HttpHeaders { @Override public List<Map.Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Map.Entry<String, String>> entries = new ArrayList<Map.Entry<String, String>>(size()); for (int i = 0; i < nameValuePairs.length; i += 2) { entries.add(new SimpleImmutableEntry<String, String>(nameValuePairs[i].toString(), nameValuePairs[i + 1].toString())); } return entries; } }
ReadOnlyHttpHeaders extends HttpHeaders { @Override public List<Map.Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Map.Entry<String, String>> entries = new ArrayList<Map.Entry<String, String>>(size()); for (int i = 0; i < nameValuePairs.length; i += 2) { entries.add(new SimpleImmutableEntry<String, String>(nameValuePairs[i].toString(), nameValuePairs[i + 1].toString())); } return entries; } ReadOnlyHttpHeaders(boolean validateHeaders, CharSequence... nameValuePairs); }
ReadOnlyHttpHeaders extends HttpHeaders { @Override public List<Map.Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Map.Entry<String, String>> entries = new ArrayList<Map.Entry<String, String>>(size()); for (int i = 0; i < nameValuePairs.length; i += 2) { entries.add(new SimpleImmutableEntry<String, String>(nameValuePairs[i].toString(), nameValuePairs[i + 1].toString())); } return entries; } ReadOnlyHttpHeaders(boolean validateHeaders, CharSequence... nameValuePairs); @Override String get(String name); @Override Integer getInt(CharSequence name); @Override int getInt(CharSequence name, int defaultValue); @Override Short getShort(CharSequence name); @Override short getShort(CharSequence name, short defaultValue); @Override Long getTimeMillis(CharSequence name); @Override long getTimeMillis(CharSequence name, long defaultValue); @Override List<String> getAll(String name); @Override List<Map.Entry<String, String>> entries(); @Override boolean contains(String name); @Override boolean contains(String name, String value, boolean ignoreCase); @Override boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase); @Override Iterator<String> valueStringIterator(CharSequence name); @Override Iterator<CharSequence> valueCharSequenceIterator(CharSequence name); @Override Iterator<Map.Entry<String, String>> iterator(); @Override Iterator<Map.Entry<CharSequence, CharSequence>> iteratorCharSequence(); @Override boolean isEmpty(); @Override int size(); @Override Set<String> names(); @Override HttpHeaders add(String name, Object value); @Override HttpHeaders add(String name, Iterable<?> values); @Override HttpHeaders addInt(CharSequence name, int value); @Override HttpHeaders addShort(CharSequence name, short value); @Override HttpHeaders set(String name, Object value); @Override HttpHeaders set(String name, Iterable<?> values); @Override HttpHeaders setInt(CharSequence name, int value); @Override HttpHeaders setShort(CharSequence name, short value); @Override HttpHeaders remove(String name); @Override HttpHeaders clear(); }
ReadOnlyHttpHeaders extends HttpHeaders { @Override public List<Map.Entry<String, String>> entries() { if (isEmpty()) { return Collections.emptyList(); } List<Map.Entry<String, String>> entries = new ArrayList<Map.Entry<String, String>>(size()); for (int i = 0; i < nameValuePairs.length; i += 2) { entries.add(new SimpleImmutableEntry<String, String>(nameValuePairs[i].toString(), nameValuePairs[i + 1].toString())); } return entries; } ReadOnlyHttpHeaders(boolean validateHeaders, CharSequence... nameValuePairs); @Override String get(String name); @Override Integer getInt(CharSequence name); @Override int getInt(CharSequence name, int defaultValue); @Override Short getShort(CharSequence name); @Override short getShort(CharSequence name, short defaultValue); @Override Long getTimeMillis(CharSequence name); @Override long getTimeMillis(CharSequence name, long defaultValue); @Override List<String> getAll(String name); @Override List<Map.Entry<String, String>> entries(); @Override boolean contains(String name); @Override boolean contains(String name, String value, boolean ignoreCase); @Override boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase); @Override Iterator<String> valueStringIterator(CharSequence name); @Override Iterator<CharSequence> valueCharSequenceIterator(CharSequence name); @Override Iterator<Map.Entry<String, String>> iterator(); @Override Iterator<Map.Entry<CharSequence, CharSequence>> iteratorCharSequence(); @Override boolean isEmpty(); @Override int size(); @Override Set<String> names(); @Override HttpHeaders add(String name, Object value); @Override HttpHeaders add(String name, Iterable<?> values); @Override HttpHeaders addInt(CharSequence name, int value); @Override HttpHeaders addShort(CharSequence name, short value); @Override HttpHeaders set(String name, Object value); @Override HttpHeaders set(String name, Iterable<?> values); @Override HttpHeaders setInt(CharSequence name, int value); @Override HttpHeaders setShort(CharSequence name, short value); @Override HttpHeaders remove(String name); @Override HttpHeaders clear();  }