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

com.github.panhongan.util.Optional Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package com.github.panhongan.util;

public class Optional {

	private T t;
	
	public Optional(T t) {
		this.t = t;
	}
	
	public boolean isEmpty() {
		return (t == null);
	}
	
	public T get() {
		return t;
	}
	
	public T getOrElse(T default_val) {
		T ret = t;
		if (isEmpty()) {
			ret = default_val;
		}
		return ret;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy