Java Collection Search hasNoValue(Collection collection)

Here you can find the source of hasNoValue(Collection collection)

Description

has No Value

License

Apache License

Declaration

public static boolean hasNoValue(Collection<?> collection) 

Method Source Code

//package com.java2s;
/*/*from w ww . j  a  va 2  s. co  m*/
 * Copyright (c) 2010-2013 Evolveum
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Collection;

public class Main {
    public static boolean hasNoValue(Collection<?> collection) {
        if (collection == null)
            return true;
        if (collection.isEmpty())
            return true;
        for (Object val : collection) {
            if (val == null)
                return true;
            if (val instanceof String && ((String) val).isEmpty())
                return true;
        }
        return false;
    }
}

Related

  1. hasElements(Collection c)
  2. hasElements(Collection collection)
  3. hasElements(Collection t)
  4. hashCapacityFor(Collection collection)
  5. hasLength(final Collection collection)
  6. hasOneItem(final Collection col)
  7. hasOtherThan(Collection a, Collection b)
  8. hasValidElement(Collection collection)
  9. hasValue(Collection collection)