Example usage for java.util Collection remove

List of usage examples for java.util Collection remove

Introduction

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

Prototype

boolean remove(Object o);

Source Link

Document

Removes a single instance of the specified element from this collection, if it is present (optional operation).

Usage

From source file:jenkins.triggers.ReverseBuildTrigger.java

@Override
public void stop() {
    super.stop();
    synchronized (upstream2Trigger) {
        for (Collection<ReverseBuildTrigger> triggers : upstream2Trigger.values()) {
            triggers.remove(this);
        }// ww  w  .j a  v a 2 s .  c  om
    }
}

From source file:net.myrrix.common.collection.FastIDSetTest.java

@Test
public void testIterator() {
    FastIDSet set = buildTestFastSet();/*  w w  w  .  j  a  va 2 s.c  o  m*/
    Collection<Long> expected = new HashSet<Long>(3);
    expected.add(1L);
    expected.add(2L);
    expected.add(3L);
    LongPrimitiveIterator it = set.iterator();
    while (it.hasNext()) {
        expected.remove(it.nextLong());
    }
    assertTrue(expected.isEmpty());
}

From source file:org.sonar.plugins.squid.SquidSensor.java

private Collection<File> getMainBytecodeFiles(Project project) {
    Collection<File> bytecodeFiles = projectClasspath.getElements();
    if (!hasProjectBytecodeFiles(project)) {
        File classesDir = project.getFileSystem().getBuildOutputDir();
        if (classesDir != null && classesDir.exists()) {
            bytecodeFiles.remove(classesDir);
        }/*www. ja  v a 2s .c  om*/
    }
    return bytecodeFiles;
}

From source file:com.nextep.designer.dbgm.services.impl.DatatypeService.java

@Override
public void removeDomain(IDomain domain) {
    allDomains.remove(domain);//www.j  a  va  2  s.co m
    Collection<IDomain> typedDomains = domainsMap.get(domain.getName());
    typedDomains.remove(domain);
}

From source file:org.pentaho.pms.ui.concept.editor.ConceptTreeModel.java

public void removeConcept(final ConceptInterface concept) throws DeleteNotAllowedException {
    Validate.notNull(concept);// w  w  w .  jav a2 s  .  com

    if (concept.getName().equalsIgnoreCase(Settings.getConceptNameBase())) {
        throw new DeleteNotAllowedException();
    }

    List<ConceptInterface> forRemoval = new ArrayList<ConceptInterface>();
    forRemoval.add(concept);

    // trigger removal from tree
    ConceptInterface parent = concept.getParentInterface();
    Collection children = (Collection) parentToChildrenMap.get(parent);
    children.remove(concept);

    // Now collect all descendants and remove from model and mark for removal from CWM repository
    removeDescendants(concept, forRemoval);

    for (Iterator iter = forRemoval.iterator(); iter.hasNext();) {
        ConceptInterface conceptToRemove = (ConceptInterface) iter.next();
        ConceptInterface orig = (ConceptInterface) origModBidiMap.remove(conceptToRemove);
        if (null != orig) {
            // if this concept exists in schema meta, it needs to be marked for removal
            markForRemoval(orig);
        } else {
            // concept has been added since last save; simply remove it from the list of concepts to be added
            newConcepts.remove(concept);
        }
    }
    fireConceptTreeModificationEvent(new ConceptTreeModificationEvent(this));
}

From source file:edu.ku.brc.af.ui.forms.BaseBusRules.java

/**
 * Removed an Object from a Collection by Id.
 * @param collection the Java Collection
 * @param dataObj the data object to be removed
 *///w w  w.  ja  v  a  2  s  .  c om
public static void removeById(final Collection<?> collection, final FormDataObjIFace dataObj) {
    for (Object obj : collection.toArray()) {
        if (obj instanceof FormDataObjIFace) {
            FormDataObjIFace colObj = (FormDataObjIFace) obj;
            if (obj == colObj || (colObj.getId() != null && dataObj.getId() != null
                    && dataObj.getId().equals(colObj.getId()))) {
                collection.remove(obj);
                break;
            }
        }
    }
}

From source file:MultiMap.java

/**
 * Removes a specific value from map.//from w ww .  j av a  2s  .  co m
 * The item is removed from the collection mapped to the specified key.
 * 
 * @param key  the key to remove from
 * @param item  the value to remove
 * @return the value removed (which was passed in)
 */
public Object remove(Object key, Object item) {
    Collection valuesForKey = (Collection) super.get(key);
    if (valuesForKey == null) {
        return null;
    }
    valuesForKey.remove(item);

    // remove the list if it is now empty
    // (saves space, and allows equals to work)
    if (valuesForKey.isEmpty()) {
        remove(key);
    }
    return item;
}

From source file:de.berlios.jhelpdesk.web.ticket.TicketNewController.java

private void cleanTicketTempDir(Collection<String> paths, String ticketstamp) {
    List<String> a = new ArrayList<String>();
    out: for (String path : paths) {
        if (path.endsWith(ticketstamp)) {
            a.add(path); // dodajemy do kolekcji do usunieci
            paths.remove(path); // i usuwamy z kolekcji w sesji
            break out;
        }/*w w w. j a  v  a 2s .com*/
    }
    FileUtils.cleanPaths(a);
}

From source file:org.netxilia.server.service.user.impl.WindowProcessorImpl.java

private void removeWindow(Window window, SheetFullName sheetName) throws NotFoundException {
    Collection<Window> windowsForSheet = windowsBySheet.get(sheetName);
    if (windowsForSheet != null) {
        windowsForSheet.remove(window);
    }/*from  www. j ava2 s.co  m*/
    // if the list is empty - remove it from the map
    if (windowsForSheet == null || windowsForSheet.size() == 0) {
        windowsBySheet.remove(window.getSheetFullName());
        workbookProcessor.getWorkbook(sheetName.getWorkbookId()).getSheet(sheetName.getSheetName())
                .removeListener(this);
    }

}

From source file:com.cloudera.oryx.common.collection.LongSetTest.java

@Test
public void testIterator() {
    LongSet set = buildTestFastSet();// w  w  w. j a v a 2 s .c  o m
    Collection<Long> expected = new HashSet<Long>(3);
    expected.add(1L);
    expected.add(2L);
    expected.add(3L);
    LongPrimitiveIterator it = set.iterator();
    while (it.hasNext()) {
        expected.remove(it.nextLong());
    }
    assertTrue(expected.isEmpty());
}