public static class TypeSwitch.Default<T> extends Object implements TypeSwitch<T>
TypeSwitch.Default<T>, TypeSwitch.Never| Modifier and Type | Method and Description |
|---|---|
<I extends T> |
is(@NotNull Class<I> type,
@NotNull Consumer<I> consumer)
Checks if the object that is switched over is of a given type and if so executes a callback.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnever, when@NotNull public <I extends T> @NotNull TypeSwitch<T> is(@NotNull @NotNull Class<I> type, @NotNull @NotNull Consumer<I> consumer)
TypeSwitchIf the type matches the returned TypeSwitch will not match any further type.
is in interface TypeSwitch<T>I - the type to checktype - the class of the type to check.consumer - the callback to execute if the type matches.