public static < T , V extends Collection < T > > V checkNotNullOrEmpty ( V arg , String argName ) throws NullPointerException , IllegalArgumentException { Preconditions . checkNotNull ( arg , argName ) ; checkArgument ( ! arg . isEmpty ( ) , argName , "Cannot be an empty collection." ) ; return arg ; }
Throws a NullPointerException if the arg argument is null . Throws an IllegalArgumentException if the Collections arg argument has a size of zero .