Package org.kiwiproject.base
Class KiwiPrimitives
- java.lang.Object
-
- org.kiwiproject.base.KiwiPrimitives
-
public class KiwiPrimitives extends Object
Static utilities that operate on primitive values, and are not already provided by classes in Guava'scom.google.common.primitivespackage.
-
-
Constructor Summary
Constructors Constructor Description KiwiPrimitives()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intfirstNonZero(int first, int second)Returns the first non-zero argument, otherwise throwsIllegalArgumentExceptionif both arguments are zero.static longfirstNonZero(long first, long second)Returns the first non-zero argument, otherwise throwsIllegalArgumentExceptionif both arguments are zero.
-
-
-
Method Detail
-
firstNonZero
public static int firstNonZero(int first, int second)Returns the first non-zero argument, otherwise throwsIllegalArgumentExceptionif both arguments are zero.- Parameters:
first- the first int to checksecond- the second int to check- Returns:
- the first non-zero value
- Throws:
IllegalArgumentException- if both arguments are zero
-
firstNonZero
public static long firstNonZero(long first, long second)Returns the first non-zero argument, otherwise throwsIllegalArgumentExceptionif both arguments are zero.- Parameters:
first- the first int to checksecond- the second int to check- Returns:
- the first non-zero value
- Throws:
IllegalArgumentException- if both arguments are zero
-
-