T
- First alternative typeU
- Second alternative type@Beta @NonNullByDefault @ThreadSafe public class Variant<T,U> extends Object
Modifier | Constructor and Description |
---|---|
protected |
Variant(T first) |
protected |
Variant(U second,
@Nullable Void dummy) |
Modifier and Type | Method and Description |
---|---|
protected com.google.common.base.MoreObjects.ToStringHelper |
addToString(com.google.common.base.MoreObjects.ToStringHelper helper) |
boolean |
equals(@Nullable Object obj) |
protected T |
first() |
T |
getFirst() |
U |
getSecond() |
int |
hashCode() |
boolean |
isFirst() |
boolean |
isSecond() |
static <T,U> Variant<T,U> |
ofFirst(T value)
Create a new instance containing specified value.
|
static <T,U> Variant<T,U> |
ofSecond(U value)
Create a new instance containing specified value.
|
protected U |
second() |
String |
toString() |
Optional<T> |
tryFirst() |
Optional<U> |
trySecond() |
protected Variant(T first)
protected final T first()
protected final U second()
public static <T,U> Variant<T,U> ofFirst(T value)
T
- First alternative typeU
- Second alternative typevalue
- ValueNullPointerException
- if value
is nullpublic static <T,U> Variant<T,U> ofSecond(U value)
T
- First alternative typeU
- Second alternative typevalue
- ValueNullPointerException
- if value
is nullpublic final boolean isFirst()
public final T getFirst()
public final boolean isSecond()
public final U getSecond()
protected com.google.common.base.MoreObjects.ToStringHelper addToString(com.google.common.base.MoreObjects.ToStringHelper helper)
Copyright © 2019 OpenDaylight. All rights reserved.