V
- the response body type for all responsesMap<HttpRequest,CompletableFuture<HttpResponse<V>>>
public class MultiMapResult<V> extends Object implements Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
Map
containing the result of a HTTP/2 request and multi-response.
This is one possible implementation of the aggregate result type <U>
returned
from HttpClient.sendAsync(HttpRequest,MultiProcessor)
.
The map is indexed by HttpRequest
and each value is a
CompletableFuture
<
HttpResponse
<V>
>
A MultiMapResult
is obtained from an invocation such as the one shown below:
CompletableFuture
<MultiMapResult<V>
>
HttpClient.sendAsync(
MultiProcessor.asMap(Function)
)
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
Removes all of the mappings from this map (optional operation).
|
boolean |
containsKey(Object key) |
Returns
true if this map contains a mapping for the specified
key. |
boolean |
containsValue(Object value) |
Returns
true if this map maps one or more keys to the
specified value. |
Set<Map.Entry<HttpRequest,CompletableFuture<HttpResponse<V>>>> |
entrySet() |
Returns a
Set view of the mappings contained in this map. |
CompletableFuture<HttpResponse<V>> |
get(Object key) |
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
boolean |
isEmpty() |
Returns
true if this map contains no key-value mappings. |
Set<HttpRequest> |
keySet() |
Returns a
Set view of the keys contained in this map. |
CompletableFuture<HttpResponse<V>> |
put(HttpRequest key,
CompletableFuture<HttpResponse<V>> value) |
Associates the specified value with the specified key in this map
(optional operation).
|
void |
putAll(Map<? extends HttpRequest,? extends CompletableFuture<HttpResponse<V>>> m) |
Copies all of the mappings from the specified map to this map
(optional operation).
|
CompletableFuture<HttpResponse<V>> |
remove(Object key) |
Removes the mapping for a key from this map if it is present
(optional operation).
|
int |
size() |
Returns the number of key-value mappings in this map.
|
Collection<CompletableFuture<HttpResponse<V>>> |
values() |
Returns a
Collection view of the values contained in this map. |
public int size()
java.util.Map
Integer.MAX_VALUE
elements, returns
Integer.MAX_VALUE
.size
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
public boolean isEmpty()
java.util.Map
true
if this map contains no key-value mappings.isEmpty
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
true
if this map contains no key-value mappingspublic boolean containsKey(Object key)
java.util.Map
true
if this map contains a mapping for the specified
key. More formally, returns true
if and only if
this map contains a mapping for a key k
such that
Objects.equals(key, k)
. (There can be
at most one such mapping.)containsKey
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
key
- key whose presence in this map is to be testedtrue
if this map contains a mapping for the specified
keypublic boolean containsValue(Object value)
java.util.Map
true
if this map maps one or more keys to the
specified value. More formally, returns true
if and only if
this map contains at least one mapping to a value v
such that
Objects.equals(value, v)
. This operation
will probably require time linear in the map size for most
implementations of the Map
interface.containsValue
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
value
- value whose presence in this map is to be testedtrue
if this map maps one or more keys to the
specified valuepublic CompletableFuture<HttpResponse<V>> get(Object key)
java.util.Map
null
if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k
to a value v
such that
Objects.equals(key, k)
,
then this method returns v
; otherwise
it returns null
. (There can be at most one such mapping.)
If this map permits null values, then a return value of
null
does not necessarily indicate that the map
contains no mapping for the key; it's also possible that the map
explicitly maps the key to null
. The containsKey
operation may be used to distinguish these two cases.
get
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
key
- the key whose associated value is to be returnednull
if this map contains no mapping for the keypublic CompletableFuture<HttpResponse<V>> put(HttpRequest key, CompletableFuture<HttpResponse<V>> value)
java.util.Map
m
is said to contain a mapping for a key k
if and only
if m.containsKey(k)
would return
true
.)put
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keykey
, or
null
if there was no mapping for key
.
(A null
return can also indicate that the map
previously associated null
with key
,
if the implementation supports null
values.)public CompletableFuture<HttpResponse<V>> remove(Object key)
java.util.Map
k
to value v
such that
Objects.equals(key, k)
, that mapping
is removed. (The map can contain at most one such mapping.)
Returns the value to which this map previously associated the key,
or null
if the map contained no mapping for the key.
If this map permits null values, then a return value of
null
does not necessarily indicate that the map
contained no mapping for the key; it's also possible that the map
explicitly mapped the key to null
.
The map will not contain a mapping for the specified key once the call returns.
remove
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
key
- key whose mapping is to be removed from the mapkey
, or
null
if there was no mapping for key
.public void putAll(Map<? extends HttpRequest,? extends CompletableFuture<HttpResponse<V>>> m)
java.util.Map
put(k, v)
on this map once
for each mapping from key k
to value v
in the
specified map. The behavior of this operation is undefined if the
specified map is modified while the operation is in progress.putAll
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
m
- mappings to be stored in this mappublic void clear()
java.util.Map
clear
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
public Set<HttpRequest> keySet()
java.util.Map
Set
view of the keys contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove
operation), the results of
the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove
, Set.remove
,
removeAll
, retainAll
, and clear
operations. It does not support the add
or addAll
operations.keySet
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
public Collection<CompletableFuture<HttpResponse<V>>> values()
java.util.Map
Collection
view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. If the map is
modified while an iteration over the collection is in progress
(except through the iterator's own remove
operation),
the results of the iteration are undefined. The collection
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove
,
Collection.remove
, removeAll
,
retainAll
and clear
operations. It does not
support the add
or addAll
operations.values
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
public Set<Map.Entry<HttpRequest,CompletableFuture<HttpResponse<V>>>> entrySet()
java.util.Map
Set
view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove
operation, or through the
setValue
operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove
,
Set.remove
, removeAll
, retainAll
and
clear
operations. It does not support the
add
or addAll
operations.entrySet
in interface Map<HttpRequest,CompletableFuture<HttpResponse<V>>>
Submit a bug or feature
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 2015, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-Debian+0-9b155-1