Here are the examples of the java api class java.util.AbstractCollection taken from open source projects.
1. HeaderMap#getHeaderNames()
View licensepublic Collection<HttpString> getHeaderNames() { if (headerNames != null) { return headerNames; } return headerNames = new AbstractCollection<HttpString>() { public boolean contains(final Object o) { return o instanceof HttpString && getEntry((HttpString) o) != null; } public boolean add(final HttpString httpString) { getOrCreateEntry(httpString); return true; } public boolean remove(final Object o) { if (!(o instanceof HttpString)) return false; HttpString s = (HttpString) o; HeaderValues entry = getEntry(s); if (entry == null) { return false; } entry.clear(); return true; } public void clear() { HeaderMap.this.clear(); } public Iterator<HttpString> iterator() { final Iterator<HeaderValues> iterator = HeaderMap.this.iterator(); return new Iterator<HttpString>() { public boolean hasNext() { return iterator.hasNext(); } public HttpString next() { return iterator.next().getHeaderName(); } public void remove() { iterator.remove(); } }; } public int size() { return HeaderMap.this.size(); } }; }