Class BasicListHeaderIterator
java.lang.Object
org.apache.hc.core5.http.message.BasicListHeaderIterator
-
Field Summary
FieldsModifier and TypeFieldDescriptionA list of headers to iterate over.private intThe position of the next header inallHeaders.private final StringThe header name to filter by.private intThe position of the last returned header. -
Constructor Summary
ConstructorsConstructorDescriptionBasicListHeaderIterator(List<Header> headers, String name) Creates a new header iterator. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanfilterHeader(int index) Checks whether a header is part of the iteration.protected intfindNext(int pos) Determines the index of the next header.booleanhasNext()next()Obtains the next header from this iteration.voidremove()Removes the header that was returned last.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
allHeaders
-
currentIndex
private int currentIndexThe position of the next header inallHeaders. Negative if the iteration is over. -
lastIndex
private int lastIndexThe position of the last returned header. Negative if none has been returned so far. -
headerName
The header name to filter by.nullto iterate over all headers in the array.
-
-
Constructor Details
-
BasicListHeaderIterator
-
-
Method Details
-
findNext
protected int findNext(int pos) Determines the index of the next header.- Parameters:
pos- one less than the index to consider first, -1 to search for the first header- Returns:
- the index of the next header that matches the filter name, or negative if there are no more headers
-
filterHeader
private boolean filterHeader(int index) Checks whether a header is part of the iteration.- Parameters:
index- the index of the header to check- Returns:
trueif the header should be part of the iteration,falseto skip
-
hasNext
-
next
Obtains the next header from this iteration.- Specified by:
nextin interfaceIterator<Header>- Returns:
- the next header in this iteration
- Throws:
NoSuchElementException- if there are no more headers
-
remove
Removes the header that was returned last.- Specified by:
removein interfaceIterator<Header>- Throws:
UnsupportedOperationException
-