Skip to content

Commit

Permalink
Return value in Collection.assertHasValue
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Mar 12, 2024
1 parent 3b6b59c commit 747171e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import java.util.Objects;

public class CollectionUtils {
public static void assertHasValue(Collection<?> coll) {
public static <T> Collection<T> assertHasValue(Collection<T> coll) {
Objects.requireNonNull(coll);
if (coll.isEmpty()) {
throw new IllegalArgumentException("Collection has no elements.");
}
return coll;
}
}

0 comments on commit 747171e

Please sign in to comment.