Skip to content

Commit

Permalink
Adding XValiAdate.
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-brandizi committed Oct 26, 2023
1 parent 5747629 commit f4dd5da
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/uk/ac/ebi/utils/objects/XValidate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package uk.ac.ebi.utils.objects;

import java.util.Collection;
import java.util.Objects;

import org.apache.commons.lang3.Validate;

/**
* Logical extension to {@link Validate}, which adds more methods.
*
* @author brandizi
* <dl><dt>Date:</dt><dd>26 Oct 2023</dd></dl>
*
*/
public class XValidate
{
/**
* Checks that the collection isn't null and isn't empty
*/
public static <C extends Collection<?>> C notEmpty (final C collection, final String message, final Object... values)
{
Validate.isTrue ( collection != null && !collection.isEmpty (), message, values );
return collection;
}
}

0 comments on commit f4dd5da

Please sign in to comment.