This repository has been archived on 2023-01-02. You can view files and clone it, but cannot push or open issues or pull requests.
data-generator-runtime/src/main/java/it/cavallium/data/generator/NativeNullable.java

25 lines
461 B
Java

package it.cavallium.data.generator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface NativeNullable<T> {
boolean isEmpty();
default boolean isPresent() {
return !isEmpty();
}
@NotNull
T orElse(@NotNull T defaultValue);
@NotNull NativeNullable<? extends T> or(@NotNull NativeNullable<? extends T> fallback);
@Nullable
T getNullable();
@Nullable
T getNullable(@Nullable T defaultValue);
}