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

com.softicar.platform.common.core.supplier.LazySupplier Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.core.supplier;

import java.util.Objects;
import java.util.function.Supplier;

public class LazySupplier implements Supplier {

	private final Supplier supplier;
	private T value;

	public LazySupplier(Supplier supplier) {

		this.supplier = Objects.requireNonNull(supplier);
		this.value = null;
	}

	@Override
	public T get() {

		if (value == null) {
			this.value = supplier.get();
		}
		return value;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy