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

com.namics.oss.magnolia.dictionary.util.Lazy Maven / Gradle / Ivy

package com.namics.oss.magnolia.dictionary.util;

import java.util.function.Supplier;

public class Lazy implements Supplier {
	private final Supplier supplier;
	private T value;

	private Lazy(final Supplier supplier) {
		this.supplier = supplier;
	}

	public static  Lazy of(Supplier supplier) {
		return new Lazy<>(supplier);
	}

	@Override
	public T get() {
		if(value == null) {
			value = supplier.get();
		}
		return value;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy