Top Description Inners Fields Constructors Methods
org.eclipse.jetty.http

pack-priv Class MutableHttpFields

extends Object
implements Mutable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.http.HttpFields.Mutable, org.eclipse.jetty.http.HttpFields, java.util.function.Supplier, java.lang.Iterable
Known Direct Subclasses
org.eclipse.jetty.http.HttpFields.MutableHttpFields, org.eclipse.jetty.http.HttpTester.Message
Imports
java.util.ArrayList, .Arrays, .Collections, .EnumSet, .Iterator, .List, .ListIterator, .NoSuchElementException, java.util.function.BiFunction, .BiPredicate, java.util.stream.Stream

HTTP Fields. A collection of HTTP header and or Trailer fields.

This class is not synchronized as it is expected that modifications will only be performed by a single thread.

The cookie handling provided by this class is guided by the Servlet specification and RFC6265.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private HttpField[]
private boolean
private int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
protected
MutableHttpFields()

Initialize an empty HttpFields.

protected
MutableHttpFields(int
the capacity of the http fields
capacity
)

Initialize an empty HttpFields.

protected
MutableHttpFields(HttpFields
the fields to copy data from
fields
)

Initialize HttpFields from another.

protected
MutableHttpFields(HttpFields
the fields to copy data from
fields
,
HttpField
the replacement field
replaceField
)

Initialize HttpFields from another and replace a field

protected
MutableHttpFields(HttpFields
the fields to copy data from
fields
,
EnumSet<HttpHeader>
the the fields to remove
removeFields
)

Initialize HttpFields from another and remove fields

Method Summary

Modifier and TypeMethod and Description
public HttpFields.Mutable
add(HttpField
the HttpField to add
field
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.add.

Adds the given HttpField to this instance.

public HttpFields.Mutable
add(HttpFields
the fields to add
fields
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.add.

Adds all the HttpFields of the given HttpFields to this instance.

public HttpFields
asImmutable()

Overrides default org.eclipse.jetty.http.HttpFields.asImmutable.

Returns an immutable copy of this HttpFields instance.

public HttpFields.Mutable
clear()

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.clear.

Removes all the fields from this instance.

public HttpFields.Mutable
computeField(HttpHeader
the field name
header
,
BiFunction<HttpHeader, List<HttpField>, HttpField>
the compute function
computeFn
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.computeField.

Computes a single field for the given HttpHeader and for existing fields with the same header.

public HttpFields.Mutable
computeField(String
the field name
name
,
BiFunction<String, List<HttpField>, HttpField>
the compute function
computeFn
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.computeField.

Computes a single field for the given HTTP field name and for existing fields with the same name.

public <T> HttpFields.Mutable
computeField(T header, BiFunction<T, List<HttpField>, HttpField> computeFn, BiPredicate<HttpField, T> matcher)

private void
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public HttpField

Returns:

A Field value or null if the Field value has not been set
getField
(int
the field index
index
)

Overrides default org.eclipse.jetty.http.HttpFields.getField.

Get a Field by index.

public HttpField
getField(HttpHeader
the field name to search for
header
)

Overrides default org.eclipse.jetty.http.HttpFields.getField.

Returns the first HttpField with the given field name, or null if no such field is present.

public HttpField
getField(String
the case-insensitive field name to search for
name
)

Overrides default org.eclipse.jetty.http.HttpFields.getField.

Returns the first HttpField with the given field name, or null if no such field is present.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public Iterator<HttpField>
iterator()

Overrides default org.eclipse.jetty.http.HttpFields.iterator.

Returns an iterator over elements of type T.

public ListIterator<HttpField>
public ListIterator<HttpField>
public HttpFields.Mutable
put(HttpField
the field to put
field
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

Puts the given HttpField into this instance.

public HttpFields.Mutable
put(String
the name of the field
name
,
String
the value of the field; if null the field is removed
value
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

This method behaves like remove(String) when the given value is null, otherwise behaves like put(HttpField).

public HttpFields.Mutable
put(HttpHeader
the name of the field
header
,
HttpHeaderValue
the value of the field; if null the field is removed
value
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

This method behaves like remove(HttpHeader) when the given value is null, otherwise behaves like put(HttpField).

public HttpFields.Mutable
put(HttpHeader
the name of the field
header
,
String
the value of the field; if null the field is removed
value
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

This method behaves like remove(HttpHeader) when the given value is null, otherwise behaves like put(HttpField).

public HttpFields.Mutable
remove(HttpHeader
the name of the fields to remove
name
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.remove.

Removes all the fields with the given name.

public HttpFields.Mutable
remove(EnumSet<HttpHeader>
the names of the fields to remove
headers
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.remove.

Removes all the fields with the given names.

public HttpFields.Mutable
remove(String
the name of the fields to remove
name
)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.remove.

Removes all the fields with the given name.

private void
remove(int i)

public int
public Stream<HttpField>
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

_fieldsback to summary
private HttpField[] _fields
_immutableback to summary
private boolean _immutable
_sizeback to summary
private int _size
INITIAL_SIZEback to summary
private static final int INITIAL_SIZE
SIZE_INCREMENTback to summary
private static final int SIZE_INCREMENT

Constructor Detail

MutableHttpFieldsback to summary
protected MutableHttpFields()

Initialize an empty HttpFields.

MutableHttpFieldsback to summary
protected MutableHttpFields(int capacity)

Initialize an empty HttpFields.

Parameters
capacity:int

the capacity of the http fields

MutableHttpFieldsback to summary
protected MutableHttpFields(HttpFields fields)

Initialize HttpFields from another.

Parameters
fields:HttpFields

the fields to copy data from

MutableHttpFieldsback to summary
protected MutableHttpFields(HttpFields fields, HttpField replaceField)

Initialize HttpFields from another and replace a field

Parameters
fields:HttpFields

the fields to copy data from

replaceField:HttpField

the replacement field

MutableHttpFieldsback to summary
protected MutableHttpFields(HttpFields fields, EnumSet<HttpHeader> removeFields)

Initialize HttpFields from another and remove fields

Parameters
fields:HttpFields

the fields to copy data from

removeFields:EnumSet<HttpHeader>

the the fields to remove

Method Detail

addback to summary
public HttpFields.Mutable add(HttpField field)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.add.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.add.

Adds the given HttpField to this instance.

Parameters
field:HttpField

the HttpField to add

Returns:HttpFields.Mutable

this instance

Annotations
@Override
addback to summary
public HttpFields.Mutable add(HttpFields fields)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.add.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.add.

Adds all the HttpFields of the given HttpFields to this instance.

Parameters
fields:HttpFields

the fields to add

Returns:HttpFields.Mutable

this instance

Annotations
@Override
asImmutableback to summary
public HttpFields asImmutable()

Overrides default org.eclipse.jetty.http.HttpFields.asImmutable.

Doc from org.eclipse.jetty.http.HttpFields.asImmutable.

Returns an immutable copy of this HttpFields instance.

Returns:HttpFields

a new immutable copy of this HttpFields instance

Annotations
@Override
clearback to summary
public HttpFields.Mutable clear()

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.clear.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.clear.

Removes all the fields from this instance.

Returns:HttpFields.Mutable

this instance

Annotations
@Override
computeFieldback to summary
public HttpFields.Mutable computeField(HttpHeader header, BiFunction<HttpHeader, List<HttpField>, HttpField> computeFn)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.computeField.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.computeField.

Computes a single field for the given HttpHeader and for existing fields with the same header.

The compute function receives the field name and a list of fields with the same name so that their values can be used to compute the value of the field that is returned by the compute function parameter. If the compute function returns null, the fields with the given name are removed.

This method comes handy when you want to add an HTTP header if it does not exist, or add a value if the HTTP header already exists, similarly to Map#compute(Object, BiFunction).

This method can be used to put a new field (or blindly replace its value):

httpFields.computeField("X-New-Header",
    (name, fields) -> new HttpField(name, "NewValue"));

This method can be used to coalesce many fields into one:

// Input:
GET / HTTP/1.1
Host: localhost
Cookie: foo=1
Cookie: bar=2,baz=3
User-Agent: Jetty

// Computation:
httpFields.computeField("Cookie", (name, fields) ->
{
    // No cookies, nothing to do.
    if (fields == null)
        return null;

    // Coalesces all cookies.
    String coalesced = fields.stream()
        .flatMap(field -> Stream.of(field.getValues()))
        .collect(Collectors.joining(", "));

    // Returns a single Cookie header with all cookies.
    return new HttpField(name, coalesced);
}

// Output:
GET / HTTP/1.1
Host: localhost
Cookie: foo=1, bar=2, baz=3
User-Agent: Jetty

This method can be used to replace a field:

httpFields.computeField("X-Length", (name, fields) ->
{
    if (fields == null)
        return null;

    // Get any value among the X-Length headers.
    String length = fields.stream()
        .map(HttpField::getValue)
        .findAny()
        .orElse("0");

    // Replace X-Length headers with X-Capacity header.
    return new HttpField("X-Capacity", length);
});

This method can be used to remove a field:

httpFields.computeField("Connection", (name, fields) -> null);
Parameters
header:HttpHeader

the field name

computeFn:BiFunction<HttpHeader, List<HttpField>, HttpField>

the compute function

Returns:HttpFields.Mutable

this instance

Annotations
@Override
computeFieldback to summary
public HttpFields.Mutable computeField(String name, BiFunction<String, List<HttpField>, HttpField> computeFn)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.computeField.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.computeField.

Computes a single field for the given HTTP field name and for existing fields with the same name.

Parameters
name:String

the field name

computeFn:BiFunction<String, List<HttpField>, HttpField>

the compute function

Returns:HttpFields.Mutable

this instance

Annotations
@Override
computeFieldback to summary
public <T> HttpFields.Mutable computeField(T header, BiFunction<T, List<HttpField>, HttpField> computeFn, BiPredicate<HttpField, T> matcher)
copyImmutableback to summary
private void copyImmutable()
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getFieldback to summary
public HttpField getField(int index)

Overrides default org.eclipse.jetty.http.HttpFields.getField.

Get a Field by index.

Parameters
index:int

the field index

Returns:HttpField

A Field value or null if the Field value has not been set

Annotations
@Override
getFieldback to summary
public HttpField getField(HttpHeader header)

Overrides default org.eclipse.jetty.http.HttpFields.getField.

Doc from org.eclipse.jetty.http.HttpFields.getField.

Returns the first HttpField with the given field name, or null if no such field is present.

Parameters
header:HttpHeader

the field name to search for

Returns:HttpField

the first HttpField with the given field name, or null if no such field is present

Annotations
@Override
getFieldback to summary
public HttpField getField(String name)

Overrides default org.eclipse.jetty.http.HttpFields.getField.

Doc from org.eclipse.jetty.http.HttpFields.getField.

Returns the first HttpField with the given field name, or null if no such field is present.

The comparison of field name is case-insensitive via HttpField#is(String).

Parameters
name:String

the case-insensitive field name to search for

Returns:HttpField

the first HttpField with the given field name, or null if no such field is present

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
iteratorback to summary
public Iterator<HttpField> iterator()

Overrides default org.eclipse.jetty.http.HttpFields.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<HttpField>

an Iterator.

Annotations
@Override
listIteratorback to summary
public ListIterator<HttpField> listIterator()

Overrides default org.eclipse.jetty.http.HttpFields.listIterator.

Returns:ListIterator<HttpField>

Doc from org.eclipse.jetty.http.HttpFields.listIterator.

an iterator over the HttpFields in this HttpFields.

Annotations
@Override
listIteratorback to summary
public ListIterator<HttpField> listIterator(int index)

Implements org.eclipse.jetty.http.HttpFields.listIterator.

Returns:ListIterator<HttpField>

Doc from org.eclipse.jetty.http.HttpFields.listIterator.

an iterator over the HttpFields in this HttpFields starting at the given index.

Annotations
@Override
putback to summary
public HttpFields.Mutable put(HttpField field)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.put.

Puts the given HttpField into this instance.

If a fields with the same name is present, the given field replaces it, and other existing fields with the same name are removed, so that only the given field will be present.

If a field with the same name is not present, the given field will be added.

Parameters
field:HttpField

the field to put

Returns:HttpFields.Mutable

this instance

Annotations
@Override
putback to summary
public HttpFields.Mutable put(String name, String value)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.put.

This method behaves like remove(String) when the given value is null, otherwise behaves like put(HttpField).

Parameters
name:String

the name of the field

value:String

the value of the field; if null the field is removed

Returns:HttpFields.Mutable

this instance

Annotations
@Override
putback to summary
public HttpFields.Mutable put(HttpHeader header, HttpHeaderValue value)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.put.

This method behaves like remove(HttpHeader) when the given value is null, otherwise behaves like put(HttpField).

Parameters
header:HttpHeader

the name of the field

value:HttpHeaderValue

the value of the field; if null the field is removed

Returns:HttpFields.Mutable

this instance

Annotations
@Override
putback to summary
public HttpFields.Mutable put(HttpHeader header, String value)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.put.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.put.

This method behaves like remove(HttpHeader) when the given value is null, otherwise behaves like put(HttpField).

Parameters
header:HttpHeader

the name of the field

value:String

the value of the field; if null the field is removed

Returns:HttpFields.Mutable

this instance

Annotations
@Override
removeback to summary
public HttpFields.Mutable remove(HttpHeader name)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.remove.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.remove.

Removes all the fields with the given name.

Parameters
name:HttpHeader

the name of the fields to remove

Returns:HttpFields.Mutable

this instance

Annotations
@Override
removeback to summary
public HttpFields.Mutable remove(EnumSet<HttpHeader> headers)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.remove.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.remove.

Removes all the fields with the given names.

Parameters
headers:EnumSet<HttpHeader>

the names of the fields to remove

Returns:HttpFields.Mutable

this instance

Annotations
@Override
removeback to summary
public HttpFields.Mutable remove(String name)

Overrides default org.eclipse.jetty.http.HttpFields.Mutable.remove.

Doc from org.eclipse.jetty.http.HttpFields.Mutable.remove.

Removes all the fields with the given name.

Parameters
name:String

the name of the fields to remove

Returns:HttpFields.Mutable

this instance

Annotations
@Override
removeback to summary
private void remove(int i)
sizeback to summary
public int size()

Overrides default org.eclipse.jetty.http.HttpFields.size.

Returns:int

Doc from org.eclipse.jetty.http.HttpFields.size.

the number of HttpFields in this instance

streamback to summary
public Stream<HttpField> stream()

Overrides default org.eclipse.jetty.http.HttpFields.stream.

Returns:Stream<HttpField>

Doc from org.eclipse.jetty.http.HttpFields.stream.

a sequential stream of the HttpFields in this instance

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.http back to summary

private Class MutableHttpFields.Listerator

extends Object
implements ListIterator<HttpField>
Class Inheritance
All Implemented Interfaces
java.util.ListIterator, java.util.Iterator

Field Summary

Modifier and TypeField and Description
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
Listerator(int index)

Method Summary

Modifier and TypeMethod and Description
public void
add(HttpField
the element to insert
field
)

Implements java.util.ListIterator.add.

Inserts the specified element into the list (optional operation).

public boolean
hasNext()

Implements java.util.ListIterator.hasNext.

Returns true if this list iterator has more elements when traversing the list in the forward direction.

public boolean
hasPrevious()

Implements java.util.ListIterator.hasPrevious.

Returns true if this list iterator has more elements when traversing the list in the reverse direction.

public HttpField
next()

Implements java.util.ListIterator.next.

Returns the next element in the list and advances the cursor position.

public int
nextIndex()

Implements java.util.ListIterator.nextIndex.

Returns the index of the element that would be returned by a subsequent call to next.

public HttpField
previous()

Implements java.util.ListIterator.previous.

Returns the previous element in the list and moves the cursor position backwards.

public int
previousIndex()

Implements java.util.ListIterator.previousIndex.

Returns the index of the element that would be returned by a subsequent call to previous.

public void
remove()

Implements java.util.ListIterator.remove.

Removes from the list the last element that was returned by next or previous (optional operation).

public void
set(HttpField
the element with which to replace the last element returned by next or previous
field
)

Implements java.util.ListIterator.set.

Replaces the last element returned by next or previous with the specified element (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_indexback to summary
private int _index
_lastback to summary
private int _last

Constructor Detail

Listeratorback to summary
pack-priv Listerator(int index)

Method Detail

addback to summary
public void add(HttpField field)

Implements java.util.ListIterator.add.

Doc from java.util.ListIterator.add.

Inserts the specified element into the list (optional operation). The element is inserted immediately before the element that would be returned by next, if any, and after the element that would be returned by previous, if any. (If the list contains no elements, the new element becomes the sole element on the list.) The new element is inserted before the implicit cursor: a subsequent call to next would be unaffected, and a subsequent call to previous would return the new element. (This call increases by one the value that would be returned by a call to nextIndex or previousIndex.)

Parameters
field:HttpField

the element to insert

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.ListIterator.hasNext.

Doc from java.util.ListIterator.hasNext.

Returns true if this list iterator has more elements when traversing the list in the forward direction. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the list iterator has more elements when traversing the list in the forward direction

Annotations
@Override
hasPreviousback to summary
public boolean hasPrevious()

Implements java.util.ListIterator.hasPrevious.

Doc from java.util.ListIterator.hasPrevious.

Returns true if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.)

Returns:boolean

true if the list iterator has more elements when traversing the list in the reverse direction

Annotations
@Override
nextback to summary
public HttpField next()

Implements java.util.ListIterator.next.

Doc from java.util.ListIterator.next.

Returns the next element in the list and advances the cursor position. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Returns:HttpField

the next element in the list

Annotations
@Override
nextIndexback to summary
public int nextIndex()

Implements java.util.ListIterator.nextIndex.

Doc from java.util.ListIterator.nextIndex.

Returns the index of the element that would be returned by a subsequent call to next. (Returns list size if the list iterator is at the end of the list.)

Returns:int

the index of the element that would be returned by a subsequent call to next, or list size if the list iterator is at the end of the list

Annotations
@Override
previousback to summary
public HttpField previous()

Implements java.util.ListIterator.previous.

Doc from java.util.ListIterator.previous.

Returns the previous element in the list and moves the cursor position backwards. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Returns:HttpField

the previous element in the list

Annotations
@Override
previousIndexback to summary
public int previousIndex()

Implements java.util.ListIterator.previousIndex.

Doc from java.util.ListIterator.previousIndex.

Returns the index of the element that would be returned by a subsequent call to previous. (Returns -1 if the list iterator is at the beginning of the list.)

Returns:int

the index of the element that would be returned by a subsequent call to previous, or -1 if the list iterator is at the beginning of the list

Annotations
@Override
removeback to summary
public void remove()

Implements java.util.ListIterator.remove.

Doc from java.util.ListIterator.remove.

Removes from the list the last element that was returned by next or previous (optional operation). This call can only be made once per call to next or previous. It can be made only if add has not been called after the last call to next or previous.

Annotations
@Override
setback to summary
public void set(HttpField field)

Implements java.util.ListIterator.set.

Doc from java.util.ListIterator.set.

Replaces the last element returned by next or previous with the specified element (optional operation). This call can be made only if neither remove nor add have been called after the last call to next or previous.

Parameters
field:HttpField

the element with which to replace the last element returned by next or previous

Annotations
@Override