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

io.polaris.core.tuple.Ref Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
package io.polaris.core.tuple;

import java.util.function.Supplier;

/**
 * @author Qt
 * @since 1.8
 */
@FunctionalInterface
public interface Ref extends Tuple {

	V get();

	default V get(Supplier loader) {
		V v = get();
		if (v == null && loader != null) {
			v = loader.get();
		}
		return v;
	}

	static  Ref of(final E value) {
		return new ValueRef<>(value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy