All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.bjurr.violations.lib.util.Optional Maven / Gradle / Ivy

There is a newer version: 1.157.3
Show newest version
package se.bjurr.violations.lib.util;

import java.io.Serializable;
import java.util.Set;

public abstract class Optional implements Serializable {
  private static final long serialVersionUID = 0;

  public static  Optional absent() {
    return Absent.withType();
  }

  public static  Optional fromNullable(final T nullableReference) {
    return nullableReference == null ? Optional.absent() : new Present<>(nullableReference);
  }

  Optional() {}

  public abstract Set asSet();

  @Override
  public abstract boolean equals(Object object);

  public abstract T get();

  @Override
  public abstract int hashCode();

  public abstract boolean isPresent();

  public abstract T or(T defaultValue);

  public abstract T orNull();

  @Override
  public abstract String toString();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy