public static < T > Collection < T > notEmpty ( Collection < T > list , String name ) { notNull ( list , name ) ; if ( list . isEmpty ( ) ) { throw new IllegalArgumentException ( String . format ( "Collection %s is empty" , name ) ) ; } return list ; }
Check that a list is not null and not empty .