Class Objects


  • public class Objects
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Objects()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equals​(java.lang.Object a, java.lang.Object b)  
      static <T> T requireNonNull​(T obj)  
      static <T> T requireNonNull​(T obj, java.lang.String message)
      Checks that the specified object reference is not null and throws a customized IllegalArgumentException if it is.
      static <T extends java.util.Collection<?>>
      T
      requireNonNullNorEmpty​(T collection, java.lang.String message)
      Require a collection to be neither null, nor empty.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • requireNonNull

        public static <T> T requireNonNull​(T obj,
                                           java.lang.String message)
                                    throws java.lang.IllegalArgumentException
        Checks that the specified object reference is not null and throws a customized IllegalArgumentException if it is.

        Note that unlike java.util.Objects, this method throws an IllegalArgumentException instead of an NullPointerException.

        Type Parameters:
        T - the type of the reference.
        Parameters:
        obj - the object reference to check for nullity.
        message - detail message to be used in the event that a IllegalArgumentException is thrown.
        Returns:
        obj if not null.
        Throws:
        java.lang.IllegalArgumentException - in case obj is null.
      • requireNonNullNorEmpty

        public static <T extends java.util.Collection<?>> T requireNonNullNorEmpty​(T collection,
                                                                                   java.lang.String message)
        Require a collection to be neither null, nor empty.
        Type Parameters:
        T - Collection type
        Parameters:
        collection - collection
        message - error message
        Returns:
        collection TODO javadoc me please
      • equals

        public static boolean equals​(java.lang.Object a,
                                     java.lang.Object b)