Example usage for java.util Set remove

List of usage examples for java.util Set remove

Introduction

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

Prototype

boolean remove(Object o);

Source Link

Document

Removes the specified element from this set if it is present (optional operation).

Usage

From source file:org.ff4j.store.FeatureStoreSpringJdbc.java

/** {@inheritDoc} */
public Set<String> readAllGroups() {
    Set<String> setOfGroup = new HashSet<String>();
    setOfGroup.addAll(//from  w  w w . j a v  a  2 s .c om
            getJdbcTemplate().query(getQueryBuilder().getAllGroups(), new SingleColumnRowMapper<String>()));
    setOfGroup.remove(null);
    setOfGroup.remove("");
    return setOfGroup;
}

From source file:org.cateproject.features.FeatureStoreSpringJDBC.java

/** {@inheritDoc} */
@Override/*www  .  j a v  a2s.c om*/
public Set<String> readAllGroups() {
    Set<String> setOfGroup = new HashSet<String>();
    setOfGroup.addAll(getJdbcTemplate().query(SQLQUERY_ALLGROUPS, new SingleColumnRowMapper<String>()));
    setOfGroup.remove(null);
    setOfGroup.remove("");
    return setOfGroup;
}

From source file:com.facebook.buck.java.JarDirectoryStepTest.java

@Test
public void jarsShouldContainDirectoryEntries() throws IOException {
    Path zipup = folder.newFolder("dir-zip");

    Path subdir = zipup.resolve("dir/subdir");
    Files.createDirectories(subdir);
    Files.write(subdir.resolve("a.txt"), "cake".getBytes());

    JarDirectoryStep step = new JarDirectoryStep(new ProjectFilesystem(zipup), Paths.get("output.jar"),
            ImmutableSet.of(zipup), /* main class */ null, /* manifest file */ null);
    ExecutionContext context = TestExecutionContext.newInstance();

    int returnCode = step.execute(context);

    assertEquals(0, returnCode);/*from  w  w  w.  j a va  2  s  .  c o m*/

    Path zip = zipup.resolve("output.jar");
    assertTrue(Files.exists(zip));

    // Iterate over each of the entries, expecting to see the directory names as entries.
    Set<String> expected = Sets.newHashSet("dir/", "dir/subdir/");
    try (ZipInputStream is = new ZipInputStream(Files.newInputStream(zip))) {
        for (ZipEntry entry = is.getNextEntry(); entry != null; entry = is.getNextEntry()) {
            expected.remove(entry.getName());
        }
    }
    assertTrue("Didn't see entries for: " + expected, expected.isEmpty());
}

From source file:com.tesora.dve.tools.DVEAnalyzerCLI.java

private static <T extends TableTemplateType> Set<T> getDifference(final Set<T> a, final Set<T> b,
        final Comparator<? super T> comparator) {
    final Set<T> difference = new TreeSet<T>(comparator);
    difference.addAll(a);//from  www .j a v  a 2  s.  c  o  m
    for (final T aItem : a) {
        for (final T bItem : b) {
            if (isMatch(aItem, bItem)) {
                difference.remove(aItem);
            }
        }
    }
    return difference;
}

From source file:net.sf.taverna.t2.activities.rshell.RshellActivityTest.java

@Test
public void testConfigureRshellActivityConfigurationBean() throws Exception {
    Set<String> expectedInputs = new HashSet<String>();
    expectedInputs.add("example_input");
    Set<String> expectedOutputs = new HashSet<String>();
    expectedOutputs.add("example_output");

    activity.configure(configurationBean);

    Set<ActivityInputPort> inputPorts = activity.getInputPorts();
    assertEquals(expectedInputs.size(), inputPorts.size());
    for (ActivityInputPort inputPort : inputPorts) {
        assertTrue("Wrong output : " + inputPort.getName(), expectedInputs.remove(inputPort.getName()));
    }//from   w  ww  . ja  v  a2s .c  o  m

    Set<ActivityOutputPort> outputPorts = activity.getOutputPorts();
    assertEquals(expectedOutputs.size(), outputPorts.size());
    for (ActivityOutputPort outputPort : outputPorts) {
        assertTrue("Wrong output : " + outputPort.getName(), expectedOutputs.remove(outputPort.getName()));
    }
}

From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java

private void eleminateSources(Vector<RenderedImage> sources, Set<RenderedImage> rootEntries) {
    if (sources != null) {
        for (RenderedImage renderedImage : sources) {
            if (rootEntries.contains(renderedImage)) {
                rootEntries.remove(renderedImage);
            }//from   w w w  .  j  a va 2s.  c o  m
            eleminateSources(renderedImage.getSources(), rootEntries);
        }
    }
}

From source file:de.uni_luebeck.inb.knowarc.usecases.invocation.local.LocalUseCaseInvocation.java

private void forgetRun() {
    Set<String> directories = runIdToTempDir.get(getRunId());
    try {/*from  ww w  . j a v a 2 s . c  om*/
        directories.remove(tempDir.getCanonicalPath());
    } catch (IOException e) {
        logger.error(e);
    }
}

From source file:com.espertech.esper.rowregex.EventRowRegexHelper.java

/**
 * Inspect variables recursively.//from  www .j  a v a 2s .  com
 * @param parent parent regex expression node
 * @param isMultiple if the variable in the stack is multiple of single
 * @param variablesSingle single variables list
 * @param variablesMultiple group variables list
 */
protected static void recursiveInspectVariables(RowRegexExprNode parent, boolean isMultiple,
        Set<String> variablesSingle, Set<String> variablesMultiple) {
    if (parent instanceof RowRegexExprNodeNested) {
        RowRegexExprNodeNested nested = (RowRegexExprNodeNested) parent;
        for (RowRegexExprNode child : parent.getChildNodes()) {
            recursiveInspectVariables(child, nested.getType().isMultipleMatches() || isMultiple,
                    variablesSingle, variablesMultiple);
        }
    } else if (parent instanceof RowRegexExprNodeAlteration) {
        for (RowRegexExprNode childAlteration : parent.getChildNodes()) {
            LinkedHashSet<String> singles = new LinkedHashSet<String>();
            LinkedHashSet<String> multiples = new LinkedHashSet<String>();

            recursiveInspectVariables(childAlteration, isMultiple, singles, multiples);

            variablesMultiple.addAll(multiples);
            variablesSingle.addAll(singles);
        }
        variablesSingle.removeAll(variablesMultiple);
    } else if (parent instanceof RowRegexExprNodeAtom) {
        RowRegexExprNodeAtom atom = (RowRegexExprNodeAtom) parent;
        String name = atom.getTag();
        if (variablesMultiple.contains(name)) {
            return;
        }
        if (variablesSingle.contains(name)) {
            variablesSingle.remove(name);
            variablesMultiple.add(name);
            return;
        }
        if (atom.getType().isMultipleMatches()) {
            variablesMultiple.add(name);
            return;
        }
        if (isMultiple) {
            variablesMultiple.add(name);
        } else {
            variablesSingle.add(name);
        }
    } else {
        for (RowRegexExprNode child : parent.getChildNodes()) {
            recursiveInspectVariables(child, isMultiple, variablesSingle, variablesMultiple);
        }
    }
}

From source file:de.iai.ilcd.model.common.DataSet.java

/**
 * Remove from data stock/*w ww  .java2 s .c  om*/
 * 
 * @param stock
 *            stock to remove from
 */
public final void removeFromDataStock(DataStock stock) {
    final Set<DataStock> containingDataStocks = this.getContainingDataStocks();
    if (containingDataStocks.contains(stock)) {
        containingDataStocks.remove(stock);
        this.removeSelfFromDataStock(stock);
    }
}

From source file:com.thoughtworks.go.domain.valuestreammap.Node.java

public boolean hasCycleInSubGraph(Set<CaseInsensitiveString> nodesInPath, Set<Node> verifiedNodes) {
    if (nodesInPath.contains(getId())) {
        return true;
    }//  ww w  .  j  a  v a2  s .co m
    nodesInPath.add(getId());
    for (Node child : getChildren()) {
        if (!verifiedNodes.contains(child)) {
            if (child.hasCycleInSubGraph(nodesInPath, verifiedNodes)) {
                return true;
            }
        }
    }
    nodesInPath.remove(getId());
    verifiedNodes.add(this);
    return false;
}