Class RedirectLocations

java.lang.Object
org.apache.hc.client5.http.protocol.RedirectLocations

public final class RedirectLocations extends Object
This class represents a collection of URIs used as redirect locations.
Since:
4.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<URI>
     
    private final Set<URI>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(URI uri)
    Adds a new URI to the collection.
    void
     
    boolean
    Test if the URI is present in the collection.
    get(int index)
    Returns the URI at the specified position in this list.
    Returns all redirect URIs in the order they were added to the collection.
    int
    Returns the number of elements in this list.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • unique

      private final Set<URI> unique
    • all

      private final List<URI> all
  • Constructor Details

    • RedirectLocations

      public RedirectLocations()
      Constructs a new instance.
  • Method Details

    • contains

      public boolean contains(URI uri)
      Test if the URI is present in the collection.
    • add

      public void add(URI uri)
      Adds a new URI to the collection.
    • getAll

      public List<URI> getAll()
      Returns all redirect URIs in the order they were added to the collection.
      Returns:
      list of all URIs
      Since:
      4.1
    • get

      public URI get(int index)
      Returns the URI at the specified position in this list.
      Parameters:
      index - index of the location to return
      Returns:
      the URI at the specified position in this list
      Throws:
      IndexOutOfBoundsException - if the index is out of range ( index &lt; 0 || index &gt;= size())
      Since:
      4.3
    • size

      public int size()
      Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
      Returns:
      the number of elements in this list
      Since:
      4.3
    • clear

      public void clear()