Package org.apache.http.impl.client
Class RedirectLocations
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<Object>
-
- org.apache.http.impl.client.RedirectLocations
-
public class RedirectLocations extends AbstractList<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, Object element)Inserts the specified element at the specified position in this list (must be a URI).voidadd(URI uri)Adds a new URI to the collection.booleancontains(Object o)Returnstrueif this collection contains the specified element.booleancontains(URI uri)Test if the URI is present in the collection.URIget(int index)Returns the URI at the specified position in this list.List<URI>getAll()Returns all redirectURIs in the order they were added to the collection.URIremove(int index)Removes the URI at the specified position in this list.booleanremove(URI uri)Removes a URI from the collection.Objectset(int index, 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
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
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.
-
remove
public boolean remove(URI uri)
Removes a URI from the collection.
-
getAll
public List<URI> getAll()
Returns all redirectURIs 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.- Specified by:
getin interfaceList<Object>- Specified by:
getin classAbstractList<Object>- 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 < 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 interfaceCollection<Object>- Specified by:
sizein interfaceList<Object>- Specified by:
sizein classAbstractCollection<Object>- Returns:
- the number of elements in this list
- Since:
- 4.3
-
set
public Object set(int index, Object element)
Replaces the URI at the specified position in this list with the specified element (must be a URI).- Specified by:
setin interfaceList<Object>- Overrides:
setin classAbstractList<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:
UnsupportedOperationException- if thesetoperation is not supported by this listClassCastException- if the element is not aURINullPointerException- if the specified element is null and this list does not permit null elementsIndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())- Since:
- 4.3
-
add
public void add(int index, 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 interfaceList<Object>- Overrides:
addin classAbstractList<Object>- Parameters:
index- index at which the specified element is to be insertedelement- URI to be inserted- Throws:
UnsupportedOperationException- if theaddoperation is not supported by this listClassCastException- if the element is not aURINullPointerException- if the specified element is null and this list does not permit null elementsIndexOutOfBoundsException- if the index is out of range (index < 0 || index > size())- Since:
- 4.3
-
remove
public 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 interfaceList<Object>- Overrides:
removein classAbstractList<Object>- Parameters:
index- the index of the URI to be removed- Returns:
- the URI previously at the specified position
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size())- Since:
- 4.3
-
contains
public boolean contains(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 interfaceCollection<Object>- Specified by:
containsin interfaceList<Object>- Overrides:
containsin classAbstractCollection<Object>- Parameters:
o- element whose presence in this collection is to be tested- Returns:
trueif this collection contains the specified element
-
-