/** * <p>Checks if an array of primitive ints is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final int[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive floats is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final float[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive booleans is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final boolean[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of Objects is not empty and not {@code null}. * * @param <T> the component type of the array * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static <T> boolean isNotEmpty(final T[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive longs is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final long[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive bytes is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final byte[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive shorts is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final short[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive doubles is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final double[] array) { return !isEmpty(array); }
/** * <p>Checks if an array of primitive chars is not empty and not {@code null}. * * @param array the array to test * @return {@code true} if the array is not empty and not {@code null} * @since 2.5 */ public static boolean isNotEmpty(final char[] array) { return !isEmpty(array); }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 3.2 */ public static Class<?>[] nullToEmpty(final Class<?>[] array) { if (isEmpty(array)) { return EMPTY_CLASS_ARRAY; } return array; }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static long[] nullToEmpty(final long[] array) { if (isEmpty(array)) { return EMPTY_LONG_ARRAY; } return array; }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static boolean[] nullToEmpty(final boolean[] array) { if (isEmpty(array)) { return EMPTY_BOOLEAN_ARRAY; } return array; }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Object[] nullToEmpty(final Object[] array) { if (isEmpty(array)) { return EMPTY_OBJECT_ARRAY; } return array; }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static char[] nullToEmpty(final char[] array) { if (isEmpty(array)) { return EMPTY_CHAR_ARRAY; } return array; }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static float[] nullToEmpty(final float[] array) { if (isEmpty(array)) { return EMPTY_FLOAT_ARRAY; } return array; }
/** * <p>Defensive programming technique to change a {@code null} * reference to an empty one. * * <p>This method returns an empty array for a {@code null} input array. * * <p>As a memory optimizing technique an empty array passed in will be overridden with * the empty {@code public static} references in this class. * * @param array the array to check for {@code null} or empty * @return the same array, {@code public static} empty array if {@code null} or empty input * @since 2.5 */ public static Byte[] nullToEmpty(final Byte[] array) { if (isEmpty(array)) { return EMPTY_BYTE_OBJECT_ARRAY; } return array; }
public String getContent() { if (isBlank(xml)) { if (ArrayUtils.isEmpty(configXmlBytes)) { xml = null; } else { xml = new String(configXmlBytes, UTF_8); } } return xml; }
private static MonitorListenerInvocationHandler createInvocationHandler( Object monitorListener, String[] tags ) { return isEmpty( tags ) ? new UntaggedMonitorListenerInvocationHandler( monitorListener ) : new TaggedMonitorListenerInvocationHandler( monitorListener, tags ); }
private boolean useAllNodeStoreScan( int[] labelIds ) { try { return ArrayUtils.isEmpty( labelIds ) || isEmptyLabelScanStore(); } catch ( Exception e ) { log.error( "Can not determine number of labeled nodes, falling back to all nodes scan.", e ); return true; } }
/** * Test for {@link ArrayUtils#isEmpty(java.lang.Object[])}. */ @Test public void testIsEmptyObject() { final Object[] emptyArray = new Object[]{}; final Object[] notEmptyArray = new Object[]{new String("Value")}; assertTrue(ArrayUtils.isEmpty((Object[]) null)); assertTrue(ArrayUtils.isEmpty(emptyArray)); assertFalse(ArrayUtils.isEmpty(notEmptyArray)); }