public final class ItemsByTag extends Object
Tag<E>
to E
, where E
can be different for each tag. The value associated with a tag may be
null
.
This is a less type-safe, but more flexible alternative to a tuple. The
tuple has a fixed number of integer-indexed, statically-typed fields,
and ItemsByTag
has a variable number of tag-indexed fields whose
whose static type is encoded in the tags.
Constructor and Description |
---|
ItemsByTag() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
<E> E |
get(Tag<E> tag)
Retrieves the value associated with the supplied tag and throws an
exception if there is none.
|
int |
hashCode() |
static ItemsByTag |
itemsByTag(Object... tagsAndVals)
Accepts an argument list of alternating tags and values, interprets
them as a list of tag-value pairs, and returns an
ItemsByTag
populated with these pairs. |
<E> void |
put(Tag<E> tag,
E value)
Associates the supplied value with the supplied tag.
|
String |
toString() |
@Nonnull public static ItemsByTag itemsByTag(@Nonnull Object... tagsAndVals)
ItemsByTag
populated with these pairs.@Nullable public <E> E get(@Nonnull Tag<E> tag)
null
,
but the returned value may be, if a null
value is explicitly
associated with a tag.IllegalArgumentException
- if there is no value associated with the supplied tagpublic <E> void put(@Nonnull Tag<E> tag, @Nullable E value)
null
, but the value may be, and in that case the tag will be
associated with a null
value.Copyright © 2021 Hazelcast, Inc.. All rights reserved.