Android examples for java.lang:Throwable
Validates if the given objects is not null.
//package com.java2s; public class Main { /**/*from w w w . j a v a 2 s.com*/ * Validates if the given objects is not null. If it is not, throws an * {@link IllegalArgumentException} with the given message. * * @param value * The value to be checked. * @param message * The message of the exception. */ public static void notNull(Object value, String message) { if (value == null) { throw new IllegalArgumentException(message); } } /** * Validates if the given objects is not null. If it is not, throws an * {@link IllegalArgumentException}. * * @param value * The value to be checked. */ public static void notNull(Object value) { notNull(value, "Null value!"); } }