Package org.apache.juneau.http.header
Class HttpHeaderList.Unmodifiable
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<HttpHeader>
org.apache.juneau.http.header.HttpHeaderList
org.apache.juneau.http.header.HttpHeaderList.Unmodifiable
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<HttpHeader>,Collection<HttpHeader>,List<HttpHeader>,RandomAccess,UnmodifiableBean
- Enclosing class:
- HttpHeaderList
An unmodifiable snapshot of a
HttpHeaderList.
This is the "collection-mutator-override" variant of the immutability paradigm. Because HttpHeaderList
extends ArrayList, a single funnel cannot intercept the inherited ArrayList mutators, so this
subclass snapshot-copies the elements in its constructor and overrides the entire collection-mutator surface — its
own fluent mutators plus the inherited ArrayList mutators (including the iterator() /
listIterator() mutators) — to throw UnsupportedOperationException. Read operations and
non-mutating iteration continue to work.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.http.header.HttpHeaderList
HttpHeaderList.Unmodifiable, HttpHeaderList.Void -
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, HttpHeader element) booleanadd(HttpHeader e) booleanaddAll(int index, Collection<? extends HttpHeader> c) booleanaddAll(Collection<? extends HttpHeader> c) Appends a header constructed from the given name and string value.Appends a header constructed from the given name and lazy value supplier.append(List<HttpHeader> values) Appends the given headers in order.append(HttpHeader value) Appends the given header.append(HttpHeader... values) Appends the given headers in order.caseSensitive(boolean value) Sets whether header-name comparisons are case-sensitive.voidclear()iterator()listIterator(int index) remove(int index) booleanRemoves all headers with the given name.booleanremoveAll(Collection<?> c) booleanremoveIf(Predicate<? super HttpHeader> filter) voidreplaceAll(UnaryOperator<HttpHeader> operator) booleanretainAll(Collection<?> c) set(int index, HttpHeader element) Sets a header with the given name and value, replacing any prior entry with the same name.set(HttpHeader value) Sets the given header, replacing any prior entry with the same name.set(HttpHeader... values) Sets the given headers, each replacing any prior entry with the same name.setDefault(String name, String value) Sets a default header with the given name and value (first-in-chain wins per name).setDefault(HttpHeader value) Sets the given header as a default.setDefault(HttpHeader... values) Sets the given headers as defaults, in order.voidsort(Comparator<? super HttpHeader> c) Methods inherited from class org.apache.juneau.http.header.HttpHeaderList
contains, copy, create, forEach, getAll, getAll, getFirst, getLast, isUnmodifiable, of, of, ofPairs, toHeaderArray, unmodifiableMethods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, lastIndexOf, removeRange, size, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Method Details
-
append
Description copied from class:HttpHeaderListAppends the given header.- Overrides:
appendin classHttpHeaderList- Parameters:
value- The header to add.nullis ignored.- Returns:
- This object.
-
append
Description copied from class:HttpHeaderListAppends the given headers in order.- Overrides:
appendin classHttpHeaderList- Parameters:
values- The headers to add.nullentries are ignored.- Returns:
- This object.
-
append
Description copied from class:HttpHeaderListAppends the given headers in order.- Overrides:
appendin classHttpHeaderList- Parameters:
values- The headers to add.nullentries are ignored.- Returns:
- This object.
-
append
Description copied from class:HttpHeaderListAppends a header constructed from the given name and string value.- Overrides:
appendin classHttpHeaderList- Parameters:
name- The header name. Must not benull .value- The header value. Can benull to omit the header from the request.- Returns:
- This object.
-
append
Description copied from class:HttpHeaderListAppends a header constructed from the given name and lazy value supplier.- Overrides:
appendin classHttpHeaderList- Parameters:
name- The header name. Must not benull .value- Supplier of the header value. Must not benull .- Returns:
- This object.
-
caseSensitive
Description copied from class:HttpHeaderListSets whether header-name comparisons are case-sensitive. Defaults tofalse.- Overrides:
caseSensitivein classHttpHeaderList- Parameters:
value- New value.- Returns:
- This object.
-
removeAll
Description copied from class:HttpHeaderListRemoves all headers with the given name.- Overrides:
removeAllin classHttpHeaderList- Parameters:
name- The header name. Must not benull .- Returns:
- This object.
-
set
Description copied from class:HttpHeaderListSets the given header, replacing any prior entry with the same name.- Overrides:
setin classHttpHeaderList- Parameters:
value- The header to set.nullis ignored.- Returns:
- This object.
-
set
Description copied from class:HttpHeaderListSets the given headers, each replacing any prior entry with the same name.- Overrides:
setin classHttpHeaderList- Parameters:
values- The headers to set.nullentries are ignored.- Returns:
- This object.
-
set
Description copied from class:HttpHeaderListSets a header with the given name and value, replacing any prior entry with the same name.- Overrides:
setin classHttpHeaderList- Parameters:
name- The header name. Must not benull .value- The header value. Can benull to omit the header from the request.- Returns:
- This object.
-
setDefault
Description copied from class:HttpHeaderListSets the given header as a default. If a header with the same name already exists, this is a no-op (first-in-chain wins per name).- Overrides:
setDefaultin classHttpHeaderList- Parameters:
value- The header to set.nullis ignored.- Returns:
- This object.
-
setDefault
Description copied from class:HttpHeaderListSets the given headers as defaults, in order. For each, if a header with the same name already exists, the entry is skipped (first-in-chain wins per name).- Overrides:
setDefaultin classHttpHeaderList- Parameters:
values- The headers to set.nullentries are ignored.- Returns:
- This object.
-
setDefault
Description copied from class:HttpHeaderListSets a default header with the given name and value (first-in-chain wins per name).- Overrides:
setDefaultin classHttpHeaderList- Parameters:
name- The header name. Must not benull .value- The header value. Can benull to omit the header from the request.- Returns:
- This object.
-
add
- Specified by:
addin interfaceCollection<HttpHeader>- Specified by:
addin interfaceList<HttpHeader>- Overrides:
addin classArrayList<HttpHeader>
-
add
- Specified by:
addin interfaceList<HttpHeader>- Overrides:
addin classArrayList<HttpHeader>
-
addAll
- Specified by:
addAllin interfaceCollection<HttpHeader>- Specified by:
addAllin interfaceList<HttpHeader>- Overrides:
addAllin classArrayList<HttpHeader>
-
addAll
- Specified by:
addAllin interfaceList<HttpHeader>- Overrides:
addAllin classArrayList<HttpHeader>
-
clear
- Specified by:
clearin interfaceCollection<HttpHeader>- Specified by:
clearin interfaceList<HttpHeader>- Overrides:
clearin classArrayList<HttpHeader>
-
remove
- Specified by:
removein interfaceCollection<HttpHeader>- Specified by:
removein interfaceList<HttpHeader>- Overrides:
removein classArrayList<HttpHeader>
-
remove
- Specified by:
removein interfaceList<HttpHeader>- Overrides:
removein classArrayList<HttpHeader>
-
removeAll
- Specified by:
removeAllin interfaceCollection<HttpHeader>- Specified by:
removeAllin interfaceList<HttpHeader>- Overrides:
removeAllin classArrayList<HttpHeader>
-
removeIf
- Specified by:
removeIfin interfaceCollection<HttpHeader>- Overrides:
removeIfin classArrayList<HttpHeader>
-
replaceAll
- Specified by:
replaceAllin interfaceList<HttpHeader>- Overrides:
replaceAllin classArrayList<HttpHeader>
-
retainAll
- Specified by:
retainAllin interfaceCollection<HttpHeader>- Specified by:
retainAllin interfaceList<HttpHeader>- Overrides:
retainAllin classArrayList<HttpHeader>
-
set
- Specified by:
setin interfaceList<HttpHeader>- Overrides:
setin classArrayList<HttpHeader>
-
sort
- Specified by:
sortin interfaceList<HttpHeader>- Overrides:
sortin classArrayList<HttpHeader>
-
iterator
- Specified by:
iteratorin interfaceCollection<HttpHeader>- Specified by:
iteratorin interfaceIterable<HttpHeader>- Specified by:
iteratorin interfaceList<HttpHeader>- Overrides:
iteratorin classArrayList<HttpHeader>
-
listIterator
- Specified by:
listIteratorin interfaceList<HttpHeader>- Overrides:
listIteratorin classArrayList<HttpHeader>
-
listIterator
- Specified by:
listIteratorin interfaceList<HttpHeader>- Overrides:
listIteratorin classArrayList<HttpHeader>
-