Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * unbox Boolean */ public static boolean unboxed(Boolean v) { return v == null ? false : v.booleanValue(); } /** * unbox Character */ public static char unboxed(Character v) { return v == null ? '\0' : v.charValue(); } /** * unbox Byte */ public static byte unboxed(Byte v) { return v == null ? 0 : v.byteValue(); } /** * unbox Short */ public static short unboxed(Short v) { return v == null ? 0 : v.shortValue(); } /** * unbox Integer */ public static int unboxed(Integer v) { return v == null ? 0 : v.intValue(); } /** * unbox Long */ public static long unboxed(Long v) { return v == null ? 0 : v.longValue(); } /** * unbox Float */ public static float unboxed(Float v) { return v == null ? 0 : v.floatValue(); } /** * unbox Double */ public static double unboxed(Double v) { return v == null ? 0 : v.doubleValue(); } /** * unbox the given type */ public static <T> T unboxed(T v) { return v; } }