org.apache.http.impl.client
Class RedirectLocations

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<Object>
          extended by org.apache.http.impl.client.RedirectLocations
All Implemented Interfaces:
Iterable<Object>, Collection<Object>, List<Object>

public class RedirectLocations
extends AbstractList<Object>

This class represents a collection of URIs used as redirect locations.

Since:
4.0

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
RedirectLocations()
           
 
Method Summary
 void add(int index, Object element)
          Inserts the specified element at the specified position in this list (must be a URI).
 void add(URI uri)
          Adds a new URI to the collection.
 boolean contains(Object o)
          Returns true if this collection contains the specified element.
 boolean contains(URI uri)
          Test if the URI is present in the collection.
 URI get(int index)
          Returns the URI at the specified position in this list.
 List<URI> getAll()
          Returns all redirect URIs in the order they were added to the collection.
 URI remove(int index)
          Removes the URI at the specified position in this list.
 boolean remove(URI uri)
          Removes a URI from the collection.
 Object set(int index, Object element)
          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.List
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

RedirectLocations

public RedirectLocations()
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 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.

Specified by:
get in interface List<Object>
Specified by:
get in class AbstractList<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 &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.

Specified by:
size in interface Collection<Object>
Specified by:
size in interface List<Object>
Specified by:
size in class AbstractCollection<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:
set in interface List<Object>
Overrides:
set in class AbstractList<Object>
Parameters:
index - index of the element to replace
element - URI to be stored at the specified position
Returns:
the URI previously at the specified position
Throws:
UnsupportedOperationException - if the set operation is not supported by this list
ClassCastException - if the element is not a URI
NullPointerException - if the specified element is null and this list does not permit null elements
IndexOutOfBoundsException - if the index is out of range ( index &lt; 0 || index &gt;= 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:
add in interface List<Object>
Overrides:
add in class AbstractList<Object>
Parameters:
index - index at which the specified element is to be inserted
element - URI to be inserted
Throws:
UnsupportedOperationException - if the add operation is not supported by this list
ClassCastException - if the element is not a URI
NullPointerException - if the specified element is null and this list does not permit null elements
IndexOutOfBoundsException - if the index is out of range ( index &lt; 0 || index &gt; 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:
remove in interface List<Object>
Overrides:
remove in class AbstractList<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 &lt; 0 || index &gt;= size())
Since:
4.3

contains

public boolean contains(Object o)
Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e)).

Specified by:
contains in interface Collection<Object>
Specified by:
contains in interface List<Object>
Overrides:
contains in class AbstractCollection<Object>
Parameters:
o - element whose presence in this collection is to be tested
Returns:
true if this collection contains the specified element


Copyright © 1999–2018 The Apache Software Foundation. All rights reserved.