angry1980.utils.Numbered Maven / Gradle / Ivy
package angry1980.utils;
import java.util.function.Function;
public class Numbered {
public static Function, Numbered> transformator(Function f){
return (numbered) -> new Numbered(numbered.getNumber(), f.apply(numbered.getValue()));
}
private final long number;
private final T value;
public Numbered(long number, T value) {
this.number = number;
this.value = value;
}
public long getNumber() {
return number;
}
public int getNumberAsInt(){
return (int)number;
}
public T getValue() {
return value;
}
@Override
public String toString() {
return "Numbered{" +
"number=" + number +
", value=" + value +
'}';
}
}