Cleanup QueuedNotificationManager
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / Immutables.java
index e10977b6de01ecd0c2254a0fd1c263f4088e8aac..da5521f7425eb9ff9ee4f1f26f0ba967367195c3 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.yangtools.util;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
 import java.math.BigDecimal;
 import java.math.BigInteger;
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
-
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.concepts.Mutable;
 
@@ -22,15 +21,14 @@ public final class Immutables {
         throw new UnsupportedOperationException("Helper class");
     }
 
-    public static final Set<Class<?>> KNOWN_IMMUTABLES = Immutables.<Class<?>> asHashSet(
-            //
+    public static final Set<Class<?>> KNOWN_IMMUTABLES = ImmutableSet.of(
             Integer.class, Short.class, BigDecimal.class, BigInteger.class, Byte.class, Character.class, Double.class,
-            Float.class, String.class);
+            Float.class, String.class, Boolean.class, Void.class);
 
     /**
      * Determines if object is known to be immutable
      *
-     * Note: This method may return false to immutable objects which
+     * <p>Note: This method may return false to immutable objects which
      * immutability is not known, was defined not using concepts term.
      *
      * @param o
@@ -38,9 +36,7 @@ public final class Immutables {
      * @return true if object is known to be immutable false otherwise.
      */
     public static boolean isImmutable(final Object o) {
-        if (o == null) {
-            throw new IllegalArgumentException("Object should not be null");
-        }
+        Preconditions.checkArgument(o != null,"Object should not be null");
         if (o instanceof Mutable) {
             return false;
         } else if (o instanceof Immutable) {
@@ -52,13 +48,4 @@ public final class Immutables {
         }
         return false;
     }
-
-    @SafeVarargs
-    private static <E> Set<E> asHashSet(final E... list) {
-        HashSet<E> ret = new HashSet<>();
-        for (E e : list) {
-            ret.add(e);
-        }
-        return Collections.unmodifiableSet(ret);
-    }
 }