Package org.apache.http.impl.client
Class RedirectLocations
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Object>
-
- org.apache.http.impl.client.RedirectLocations
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Object>,java.util.Collection<java.lang.Object>,java.util.List<java.lang.Object>
public class RedirectLocations extends java.util.AbstractList<java.lang.Object>This class represents a collection ofURIs used as redirect locations.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description RedirectLocations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Object element)Inserts the specified element at the specified position in this list (must be a URI).voidadd(java.net.URI uri)Adds a new URI to the collection.booleancontains(java.lang.Object o)Returnstrueif this collection contains the specified element.booleancontains(java.net.URI uri)Test if the URI is present in the collection.java.net.URIget(int index)Returns the URI at the specified position in this list.java.util.List<java.net.URI>getAll()Returns all redirectURIs in the order they were added to the collection.java.net.URIremove(int index)Removes the URI at the specified position in this list.booleanremove(java.net.URI uri)Removes a URI from the collection.java.lang.Objectset(int index, java.lang.Object element)Replaces the URI at the specified position in this list with the specified element (must be a URI).intsize()Returns the number of elements in this list.-
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
-
-
-
-
Method Detail
-
contains
public boolean contains(java.net.URI uri)
Test if the URI is present in the collection.
-
add
public void add(java.net.URI uri)
Adds a new URI to the collection.
-
remove
public boolean remove(java.net.URI uri)
Removes a URI from the collection.
-
getAll
public java.util.List<java.net.URI> getAll()
Returns all redirectURIs in the order they were added to the collection.- Returns:
- list of all URIs
- Since:
- 4.1
-
get
public java.net.URI get(int index)
Returns the URI at the specified position in this list.- Specified by:
getin interfacejava.util.List<java.lang.Object>- Specified by:
getin classjava.util.AbstractList<java.lang.Object>- Parameters:
index- index of the location to return- Returns:
- the URI at the specified position in this list
- Throws:
java.lang.IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())- Since:
- 4.3
-
size
public int size()
Returns the number of elements in this list. If this list contains more thanInteger.MAX_VALUEelements, returnsInteger.MAX_VALUE.- Specified by:
sizein interfacejava.util.Collection<java.lang.Object>- Specified by:
sizein interfacejava.util.List<java.lang.Object>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Object>- Returns:
- the number of elements in this list
- Since:
- 4.3
-
set
public java.lang.Object set(int index, java.lang.Object element)Replaces the URI at the specified position in this list with the specified element (must be a URI).- Specified by:
setin interfacejava.util.List<java.lang.Object>- Overrides:
setin classjava.util.AbstractList<java.lang.Object>- Parameters:
index- index of the element to replaceelement- URI to be stored at the specified position- Returns:
- the URI previously at the specified position
- Throws:
java.lang.UnsupportedOperationException- if thesetoperation is not supported by this listjava.lang.ClassCastException- if the element is not aURIjava.lang.NullPointerException- if the specified element is null and this list does not permit null elementsjava.lang.IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())- Since:
- 4.3
-
add
public void add(int index, java.lang.Object element)Inserts the specified element at the specified position in this list (must be a URI). Shifts the URI currently at that position (if any) and any subsequent URIs to the right (adds one to their indices).- Specified by:
addin interfacejava.util.List<java.lang.Object>- Overrides:
addin classjava.util.AbstractList<java.lang.Object>- Parameters:
index- index at which the specified element is to be insertedelement- URI to be inserted- Throws:
java.lang.UnsupportedOperationException- if theaddoperation is not supported by this listjava.lang.ClassCastException- if the element is not aURIjava.lang.NullPointerException- if the specified element is null and this list does not permit null elementsjava.lang.IndexOutOfBoundsException- if the index is out of range (index < 0 || index > size())- Since:
- 4.3
-
remove
public java.net.URI remove(int index)
Removes the URI at the specified position in this list. Shifts any subsequent URIs to the left (subtracts one from their indices). Returns the URI that was removed from the list.- Specified by:
removein interfacejava.util.List<java.lang.Object>- Overrides:
removein classjava.util.AbstractList<java.lang.Object>- Parameters:
index- the index of the URI to be removed- Returns:
- the URI previously at the specified position
- Throws:
java.lang.IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())- Since:
- 4.3
-
contains
public boolean contains(java.lang.Object o)
Returnstrueif this collection contains the specified element. More formally, returnstrueif and only if this collection contains at least one elementesuch that(o==null ? e==null : o.equals(e)).- Specified by:
containsin interfacejava.util.Collection<java.lang.Object>- Specified by:
containsin interfacejava.util.List<java.lang.Object>- Overrides:
containsin classjava.util.AbstractCollection<java.lang.Object>- Parameters:
o- element whose presence in this collection is to be tested- Returns:
trueif this collection contains the specified element
-
-