File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
src/main/java/net/marcellperger/mathexpr/util Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,7 @@ protected Util() {}
5959 @ SuppressWarnings ("UnusedReturnValue" )
6060 @ Contract ("_ -> param1" )
6161 public static <C extends Collection <?>> @ NotNull C requireNonEmpty (@ NotNull C collection ) {
62- // IllegalArgumentException might not always be appropriate
63- if (collection .isEmpty ()) throw new IllegalArgumentException ("Argument must not be empty" );
62+ if (collection .isEmpty ()) throw new CollectionSizeException ("Argument must not be empty" );
6463 return collection ;
6564 }
6665 @ SuppressWarnings ("UnusedReturnValue" )
@@ -70,8 +69,7 @@ protected Util() {}
7069 }
7170 @ Contract ("_,_ -> param1" )
7271 public static <C extends Collection <?>> @ NotNull C requireNonEmpty (@ NotNull C collection , String msg ) {
73- // IllegalArgumentException might not always be appropriate
74- if (collection .isEmpty ()) throw new IllegalArgumentException (msg );
72+ if (collection .isEmpty ()) throw new CollectionSizeException (msg );
7573 return collection ;
7674 }
7775 @ SuppressWarnings ("UnusedReturnValue" )
@@ -81,7 +79,6 @@ protected Util() {}
8179 }
8280 @ Contract ("_,_ -> param1" )
8381 public static <C extends Collection <?>> @ NotNull C requireNonEmpty (@ NotNull C collection , RuntimeException exc ) {
84- // IllegalArgumentException might not always be appropriate
8582 if (collection .isEmpty ()) throw exc ;
8683 return collection ;
8784 }
You can’t perform that action at this time.
0 commit comments