Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get wrapper class for primitive

  // safe because both Long.class and long.class are of type Class<Long>
  @SuppressWarnings("unchecked")
  private static <T> Class<T> wrap(Class<T> c) {
    return c.isPrimitive() ? (Class<T>) PRIMITIVES_TO_WRAPPERS.get(c) : c;
  }

  private static final Map<Class<?>, Class<?>> PRIMITIVES_TO_WRAPPERS
    = new ImmutableMap.Builder<Class<?>, Class<?>>()
      .put(boolean.class, Boolean.class)
      .put(byte.class, Byte.class)
      .put(char.class, Character.class)
      .put(double.class, Double.class)
      .put(float.class, Float.class)
      .put(int.class, Integer.class)
      .put(long.class, Long.class)
      .put(short.class, Short.class)
      .put(void.class, Void.class)
      .build();
Comment

PREVIOUS NEXT
Code Example
Java :: expression régulière seulement un espace java 
Java :: unirest javafx 
Java :: how to make bidirectional fromated binding 
Java :: trier un tableau de string java 
Java :: What is the use of @Listener annotation in TestNG? 
Java :: remove character stringbuffer 
Java :: java returning an comparable array of inorder traversal of binary tree 
Java :: format string precision double java 
Java :: what is difference between constant and final in java 
Java :: Get Subarray from Array 
Java :: blast multiple protein files 
Java :: force_dark_auto android webview 
Java :: nonnull annotation in java 
Java :: mincraft command in plugin 
Java :: Iterating & Adding to a Stack 
Java :: how-to-use-volley-string-request-in-android 
Java :: cellrangeaddress in set border example in java 
Java :: Java Enable assertion in package names 
Java :: diamonds 
Java :: wsl-allow-port 
Java :: android on change class event 
Java :: bigint is built in object 
Java :: factorial java recursion 
Java :: List Double, fixed size 
Java :: Java Insert Elements to EnumSet 
Java :: Class inheritance and encapsulation 
Java :: leetcode egg drop 
Java :: firemonkey android ini file 
Java :: how to clear the consol after input java 
Java :: adding matrix 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =