Class Defaults


  • @GwtIncompatible
    public final class Defaults
    extends Object
    This class provides default values for all Java types, as defined by the JLS.
    Since:
    1.0
    Author:
    Ben Yu
    • Method Detail

      • defaultValue

        @NullableDecl
        public static <T> T defaultValue​(Class<T> type)
        Returns the default value of type as defined by JLS --- 0 for numbers, false for boolean and '\0' for char. For non-primitive types and void, null is returned.