Java List Null Empty addAllIfAllValuesNotNull(List list, V[] values)

Here you can find the source of addAllIfAllValuesNotNull(List list, V[] values)

Description

add All If All Values Not Null

License

Apache License

Declaration

public static <V> boolean addAllIfAllValuesNotNull(List<V> list, V[] values) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static <V> boolean addAllIfAllValuesNotNull(List<V> list, V[] values) {
        if (values == null) {
            return false;
        }// w w w  . j a v a  2s . c  om

        for (V value : values) {
            if (value == null) {
                return false;
            }
        }

        for (V value : values) {
            list.add(value);
        }

        return true;
    }
}

Related

  1. addAllExceptNullValue(List list, V[] values)
  2. addIfNotNull(final List list, final T value)
  3. addIfNotNull(List l, T o)
  4. addIfValueNotNull(List list, V value)
  5. addIgnoreNull(final List list, final T... objects)