Example usage for java.util Iterator remove

List of usage examples for java.util Iterator remove

Introduction

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

Prototype

default void remove() 

Source Link

Document

Removes from the underlying collection the last element returned by this iterator (optional operation).

Usage

From source file:com.netflix.blitz4j.NFAppenderAttachableImpl.java

@Override
public void removeAppender(String name) {
    if (name == null || appenderList == null)
        return;//from ww w  .ja  v  a2s.c  om
    Iterator<Appender> it = appenderList.iterator();
    while (it.hasNext()) {
        Appender a = (Appender) it.next();
        if (name.equals(a.getName())) {
            it.remove();
            configuredAppenderList.remove(a.getName());
            break;
        }
    }
}

From source file:io.tilt.minka.spectator.Wells.java

/**
 * If you plan to dinamically consume from a lot of Wells, you should release them when no longer care.
 * Otherwise non closed subscription resources will only be released at shutdown 
 * (subject to proper termination)//ww  w. j ava 2 s  . c o m
 * @param wellName
 */
public void closeWell(final String wellName) {
    Set<UserInstanceObject> set = getUserMap().get(wellName);
    if (set != null) {
        Iterator<UserInstanceObject> it = set.iterator();
        while (it.hasNext()) {
            UserInstanceObject uio = it.next();
            if (uio.getTree() != null) {
                uio.getTree().close();
                it.remove();
            }
        }
    }
}

From source file:SoftSet.java

public boolean retainAll(Collection c) {
    Iterator iter = iterator();
    boolean removed = false;
    while (iter.hasNext()) {
        Object value = iter.next();
        if (c.contains(value) == false) {
            iter.remove();
            removed = true;/*ww  w  .  j  a  v  a 2 s .  c om*/
        }
    }
    return removed;
}

From source file:com.google.code.ssm.test.svc.AppUserServiceImpl.java

private List<Integer> removeWithDifferentAuth(final List<AppUser> appUsers, final boolean authorized) {
    List<Integer> removedAppIds = new ArrayList<Integer>();
    Iterator<AppUser> iter = appUsers.iterator();
    AppUser appUser = null;/*  w  w  w  . j  a va 2  s. co  m*/

    while (iter.hasNext()) {
        appUser = iter.next();
        if (appUser.isEnabled() != authorized) {
            iter.remove();
            removedAppIds.add(appUser.getApplicationId());
        }
    }

    return removedAppIds;
}

From source file:pl.exsio.frameset.vaadin.bootstrap.spring.scope.UIScope.java

private void removeBeans(UI ui) {
    Set<String> keys = beans.keySet();
    Iterator<String> iter = keys.iterator();

    while (iter.hasNext()) {
        String key = iter.next();
        String prefix = getConversationId(ui);

        if (key.startsWith(prefix)) {
            iter.remove();
            if (log.isDebugEnabled()) {
                log.debug("Removed bean [" + key + "]");
            }//from w  ww.j ava2 s  .c o m
            Runnable callback = callbacks.remove(key);
            if (callback != null) {
                callback.run();
            }
        }
    }

}

From source file:org.jboss.aerogear.sync.client.ClientSyncEngine.java

private void discardEdit(final S edit, final String documentId, final String clientId,
        final Iterator<S> iterator) {
    dataStore.removeEdit(edit, documentId, clientId);
    iterator.remove();
}

From source file:org.springframework.cloud.dataflow.rest.client.DataflowTemplateTests.java

@Test
public void testPrepareRestTemplateWithRestTemplateThatMissesJacksonConverter() {
    final RestTemplate providedRestTemplate = new RestTemplate();
    final Iterator<HttpMessageConverter<?>> iterator = providedRestTemplate.getMessageConverters().iterator();

    while (iterator.hasNext()) {
        if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
            iterator.remove();
        }//w w  w.j  av a2 s.  co  m
    }

    try {
        DataFlowTemplate.prepareRestTemplate(providedRestTemplate);
    } catch (IllegalArgumentException e) {
        assertEquals("The RestTemplate does not contain a required MappingJackson2HttpMessageConverter.",
                e.getMessage());
        return;
    }

    fail("Expected an IllegalArgumentException to be thrown.");
}

From source file:org.freeeed.search.web.solr.SolrTagService.java

private void removeTag(List<Tag> tags, String tag) {
    Iterator<Tag> i = tags.iterator();
    while (i.hasNext()) {
        Tag tagObj = i.next();//w  w  w.ja  v a2 s . c o m
        if (tag.equalsIgnoreCase(tagObj.getValue())) {
            i.remove();
        }
    }
}

From source file:com.icesoft.applications.faces.auctionMonitor.ChatState.java

/**
 * Method to loop through all children UserBeans and move each
 * to the bottom of the chat log//w  ww .j  a v a 2  s.  c  om
*/
public void updateAll() {
    Iterator users = userList.iterator();
    UserBean current;
    while (users.hasNext()) {
        current = (UserBean) users.next();

        if (current != null) {
            current.moveToBottom();
        } else {
            users.remove();
        }
    }

}

From source file:de.laures.cewolf.taglib.AbstractChartDefinition.java

public void removeLegend() {
    List subTitles = chart.getSubtitles();
    Iterator iter = subTitles.iterator();
    while (iter.hasNext()) {
        Object o = iter.next();/*  w ww.  j a v a 2  s  .  com*/
        if (o instanceof LegendTitle) {
            iter.remove();
            break;
        }
    }
}