com.jfreeman.lazy.Constant Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lazy Show documentation
Show all versions of lazy Show documentation
A library for type-safe, tractable lazy evaluation and late binding in Java.
package com.jfreeman.lazy;
/**
* A lazy constant (i.e. a value with no dependencies).
*/
public final class Constant
extends AbstractThunk
{
private Constant(T value) {
_value = value;
}
public static Constant of(T value) {
return new Constant<>(value);
}
@Override
public boolean isForced() {
return true;
}
@Override
public Iterable extends Lazy>> getDependencies()
throws IllegalStateException
{
throw new IllegalStateException("already forced");
}
@Override
public T force()
throws IllegalStateException
{
throw new IllegalStateException("already forced");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy