Example usage for java.util Set isEmpty

List of usage examples for java.util Set isEmpty

Introduction

In this page you can find the example usage for java.util Set isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this set contains no elements.

Usage

From source file:Main.java

protected static void checkExcludedIP(Set excluded, byte[] ip) throws CertPathValidatorException {
    if (excluded.isEmpty()) {
        return;/*from   w ww .ja v  a 2s.  c  o  m*/
    }

    // TODO, check RFC791 and RFC1883 for IP bytes definition.
}

From source file:Main.java

protected static void checkPermittedIP(Set permitted, byte[] ip) throws CertPathValidatorException {
    if (permitted.isEmpty()) {
        return;/*from  w  w  w  .  ja v a  2s.com*/
    }

    // TODO: ??? Something here
}

From source file:Main.java

public static boolean isEmpty(Set<?> set) {
    return set == null || set.isEmpty();
}

From source file:Main.java

protected static boolean isAnyPolicy(Set policySet) {
    return policySet == null || policySet.contains(ANY_POLICY) || policySet.isEmpty();
}

From source file:Main.java

public static <T> Set<T> unmodifiableSet(Set<? extends T> list) {
    if ((list == null) || (list.isEmpty())) {
        return Collections.emptySet();
    }//from   www . jav  a 2 s .com
    return Collections.unmodifiableSet(list);
}

From source file:Main.java

protected static void checkExcludedEmail(Set excluded, String email) throws CertPathValidatorException {
    if (excluded.isEmpty()) {
        return;//from   w  w  w .j ava 2 s. co  m
    }

    String sub = email.substring(email.indexOf('@') + 1);
    Iterator it = excluded.iterator();

    while (it.hasNext()) {
        String str = (String) it.next();
        if (sub.endsWith(str)) {
            throw new CertPathValidatorException("Subject email address is from an excluded subtree");
        }
    }
}

From source file:Main.java

protected static void checkPermittedEmail(Set permitted, String email) throws CertPathValidatorException {
    if (permitted.isEmpty()) {
        return;//from  w  w w. jav  a2 s. c o m
    }

    String sub = email.substring(email.indexOf('@') + 1);
    Iterator it = permitted.iterator();

    while (it.hasNext()) {
        String str = (String) it.next();

        if (sub.endsWith(str)) {
            return;
        }
    }

    throw new CertPathValidatorException("Subject email address is not from a permitted subtree");
}

From source file:it.polimi.tower4clouds.rules.batch.BatchTool.java

private static void printResult(Set<Problem> problems) {
    if (problems.isEmpty())
        System.out.println("Validation successful");
    else {//from   w w  w .  j  av  a  2s.co m
        System.out.println("Validation failed. Details follow:");
        for (Problem p : problems) {
            System.out.println("Monitoring rule " + p.getId() + ": " + p.getError() + " at position "
                    + p.getTagName() + ", " + p.getDescription());
        }
    }
}

From source file:Main.java

public static boolean checkMusePaired() {
    Set<BluetoothDevice> devices = findPaired();

    if (devices == null || devices.isEmpty()) {
        return false;
    }/*from   w w w  .  j  a va  2  s  .  com*/

    for (BluetoothDevice device : devices) {
        if (device.getName().equalsIgnoreCase("muse")) {
            return true;
        }
    }

    return false;
}

From source file:Main.java

/**
 * Returns String from a map of string of set of string.
 *
 * @param map Map of string of set of string.
 * @param name Key of the map entry./*from   w  ww.j a  v a2s  . c o m*/
 * @return String from a map of string of set of string
 */
public static String getMapAttr(Map map, String name) {
    Set s = (Set) map.get(name);
    String retVal = ((s == null) || s.isEmpty()) ? null : ((String) s.iterator().next());
    return (retVal != null) ? retVal.trim() : null;
}