Package org.apache.http.impl.client
Class RedirectLocations
- All Implemented Interfaces:
Iterable<Object>
,Collection<Object>
,List<Object>
,SequencedCollection<Object>
This class represents a collection of
URI
s used
as redirect locations.- Since:
- 4.0
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts the specified element at the specified position in this list (must be a URI).void
Adds a new URI to the collection.boolean
Returnstrue
if this collection contains the specified element.boolean
Test if the URI is present in the collection.get
(int index) Returns the URI at the specified position in this list.getAll()
Returns all redirectURI
s in the order they were added to the collection.remove
(int index) Removes the URI at the specified position in this list.boolean
Removes a URI from the collection.Replaces the URI at the specified position in this list with the specified element (must be a URI).int
size()
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, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, addFirst, addLast, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Constructor Details
-
RedirectLocations
public RedirectLocations()
-
-
Method Details
-
contains
Test if the URI is present in the collection. -
add
Adds a new URI to the collection. -
remove
Removes a URI from the collection. -
getAll
Returns all redirectURI
s in the order they were added to the collection.- Returns:
- list of all URIs
- Since:
- 4.1
-
get
Returns the URI at the specified position in this list.- Specified by:
get
in interfaceList<Object>
- Specified by:
get
in 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_VALUE
elements, returnsInteger.MAX_VALUE
.- Specified by:
size
in interfaceCollection<Object>
- Specified by:
size
in interfaceList<Object>
- Specified by:
size
in classAbstractCollection<Object>
- Returns:
- the number of elements in this list
- Since:
- 4.3
-
set
Replaces the URI at the specified position in this list with the specified element (must be a URI).- Specified by:
set
in interfaceList<Object>
- Overrides:
set
in 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 theset
operation is not supported by this listClassCastException
- if the element is not aURI
NullPointerException
- 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
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:
add
in interfaceList<Object>
- Overrides:
add
in classAbstractList<Object>
- Parameters:
index
- index at which the specified element is to be insertedelement
- URI to be inserted- Throws:
UnsupportedOperationException
- if theadd
operation is not supported by this listClassCastException
- if the element is not aURI
NullPointerException
- 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
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:
remove
in interfaceList<Object>
- Overrides:
remove
in 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
Returnstrue
if this collection contains the specified element. More formally, returnstrue
if and only if this collection contains at least one elemente
such that(o==null ? e==null : o.equals(e))
.- Specified by:
contains
in interfaceCollection<Object>
- Specified by:
contains
in interfaceList<Object>
- Overrides:
contains
in classAbstractCollection<Object>
- Parameters:
o
- element whose presence in this collection is to be tested- Returns:
true
if this collection contains the specified element
-