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

com.thejohnfreeman.lazy.Constant Maven / Gradle / Ivy

Go to download

A library for type-safe, tractable lazy evaluation and late binding in Java.

The newest version!
package com.thejohnfreeman.lazy;

/**
 * A lazy constant (i.e. a value with no dependencies).
 */
public final class Constant
    extends AbstractThunk
{
    private Constant(final T value) {
        _value = value;
    }

    public static  Constant of(final T value) {
        return new Constant<>(value);
    }

    @Override
    public boolean isForced() {
        return true;
    }

    @Override
    public Iterable> getDependencies()
        throws IllegalStateException
    {
        throw new IllegalStateException("already forced");
    }

    @Override
    public T forceThis()
        throws IllegalStateException
    {
        throw new IllegalStateException("already forced");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy