Example usage for java.util Set removeAll

List of usage examples for java.util Set removeAll

Introduction

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

Prototype

boolean removeAll(Collection<?> c);

Source Link

Document

Removes from this set all of its elements that are contained in the specified collection (optional operation).

Usage

From source file:com.streamsets.datacollector.lineage.LineageEventImpl.java

@Override
public List<LineageSpecificAttribute> missingSpecificAttributes() {
    LineageEventType type;//from ww  w.j a v a2s  .  c o  m
    try {
        type = getEventType();
    } catch (IllegalArgumentException | NullPointerException ex) {
        throw new IllegalArgumentException(
                Utils.format(ContainerError.CONTAINER_01404.getMessage(), getEventType()));
    }

    Set<LineageSpecificAttribute> badFields = new HashSet<>(type.getSpecificAttributes());

    // Remove attributes we have - from the group of attributes we expect...
    badFields.removeAll(specificAttributes.keySet());

    // at this point, badFields is a list of attributes we
    // expected to be there, but are missing.

    // now we add attributes which are there, but may have null or empty values.
    for (LineageSpecificAttribute att : type.getSpecificAttributes()) {
        if (StringUtils.isEmpty(specificAttributes.get(att))) {
            badFields.add(att);
        }
    }

    return new ArrayList<>(badFields);
}

From source file:es.emergya.bbdd.dao.RolHome.java

public Set<Flota> getDisponibles(Rol r) {
    Set<Flota> res = new HashSet<Flota>();
    Flota f = new Flota();
    f.setHabilitada(true);/*from  ww w .j  a  v  a 2s  .com*/
    res.addAll(FlotaConsultas.getByExample(f));
    try {
        res.removeAll(getAsigned(r));
    } catch (Throwable t1) {
        log.error(t1, t1);
    }
    return res;
}

From source file:de.iteratec.iteraplan.general.PropertiesTest.java

private void logDifferences(Set<?> first, Set<?> second) {
    Set<Object> firstCopy = new HashSet<Object>(first);
    firstCopy.removeAll(second);
    LOGGER.info(firstCopy.toString());/*  w w  w.  ja v  a2s . co  m*/
}

From source file:com.autentia.wuija.widget.SelectManyLists.java

public void restrictValues(Collection<T> values) {
    final Set<T> allowedValues = new HashSet<T>(values);

    allowedValues.removeAll(getSelectedItems());
    getSelectedValuesList().retainAll(values);

    getAllowedValuesList().clear();// w  w w . j  a  v  a  2 s  . c o  m
    addAllToAllowed(allowedValues);
}

From source file:ee.ria.xroad.common.hashchain.HashChainVerifier.java

private void checkReferencedInputs() {
    LOG.trace("checkReferencedInputs(). Used = {}", usedInputs);
    Set<String> untouchedInputs = new HashSet<>(inputs.keySet());
    untouchedInputs.removeAll(usedInputs);

    if (!untouchedInputs.isEmpty()) {
        throw new CodedException(X_HASHCHAIN_UNUSED_INPUTS, "Some inputs were not referenced by hash chain: %s",
                StringUtils.join(untouchedInputs, ", "));
    }/*  w  w  w. j av a2 s.  com*/
}

From source file:com.vmware.bdd.plugin.clouderamgr.service.CmClusterValidator.java

private boolean checkRequiredRoles(String serviceName, Set<String> requiredRoles, Set<String> definedRoles,
        List<String> errorMsgList) {
    requiredRoles.removeAll(definedRoles);
    if (!requiredRoles.isEmpty()) {
        errorMsgList.add("Service " + serviceName + " requires roles " + requiredRoles.toString());
        return false;
    }//ww w  .j  a  v a2s  . c  o m
    return true;
}

From source file:de.iteratec.iteraplan.general.PropertiesTest.java

private void logDifferencesExtended(Set<?> first, Set<?> second, LanguageFile l, LanguageFile k) {
    Set<Object> firstCopy = new HashSet<Object>(first);
    firstCopy.removeAll(second);
    for (Object key : firstCopy) {
        LOGGER.info("Key: {0}", key);
        if (l != null) {
            LOGGER.warn("{0}: {1}", l.language, l.properties.get(key));
        }// w w w.j  a va 2 s  .com
        if (k != null) {
            LOGGER.warn("{0}: {1}", k.language, k.properties.get(key));
        }
    }
}

From source file:gov.nih.nci.caarray.plugins.nimblegen.NdfHandler.java

private void validateHeader(Map<String, Integer> headers, FileValidationResult result) throws IOException {
    if (headers == null) {
        result.addMessage(ValidationMessage.Type.ERROR, "Could not find column headers in file. Header must "
                + " contain at least the following column headings: " + NDF_REQUIRED_COLUMNS.keySet());
    } else {/* w  ww. j  av  a2 s  .  c o  m*/
        final Set<String> missing = new HashSet<String>(NDF_REQUIRED_COLUMNS.keySet());
        missing.removeAll(headers.keySet());

        for (final String col : missing) {
            result.addMessage(ValidationMessage.Type.ERROR,
                    "Invalid column header for Nimblegen NDF. Missing " + col + " column",
                    this.reader.getCurrentLineNumber(), 0);
        }
    }
}

From source file:br.usp.poli.lta.cereda.nfa2dfa.utils.Conversion.java

private Set<Set<Integer>> split(Set<Integer> S, Set<Set<Integer>> p) {
    Set<Set<Integer>> result = new HashSet<>();
    Set<Token> sigma = alphabet();
    Set<Integer> temp = null;

    HashSet<Integer> s2 = new HashSet<>();
    for (Token c : sigma) {
        for (int s : S) {
            if (temp == null) {
                temp = getSet(s, c, p);// w w  w  .j  a v a  2  s  . co  m
            } else {
                if (!temp.equals(getSet(s, c, p))) {
                    s2.add(s);
                }
            }
        }
        temp = null;
    }

    if (!s2.isEmpty()) {
        Set<Integer> s1 = new HashSet<>(S);
        s1.removeAll(s2);
        result.add(s1);
        result.add(s2);
    } else {
        result.add(S);
    }

    return result;
}

From source file:com.perl5.lang.htmlmason.idea.configuration.HTMLMasonSettingsConfigurable.java

protected Set<String> getDiff(List<String> first, List<String> second) {
    Set<String> diff = new THashSet<String>(first);
    diff.removeAll(second);

    Set<String> temp = new THashSet<String>(second);
    temp.removeAll(first);//w  w w . ja v  a  2 s . co  m
    diff.addAll(temp);

    return diff;
}