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:net.duckling.ddl.web.api.pan.APIPanListController.java

private void filterByType(List<PanResourceBean> result, String type) {
    if ("Picture".equals(type)) {
        Iterator<PanResourceBean> it = result.iterator();
        while (it.hasNext()) {
            PanResourceBean bean = it.next();
            if (!FileTypeUtils.isClbDealImage(bean.getTitle())) {
                it.remove();
            }/*from www.j  a  v a 2s.c om*/
        }
    }
}

From source file:eu.uqasar.util.ldap.LdapManager.java

private List<LdapGroup> filterGroupsList(List<LdapGroup> groups) throws NamingException {
    Iterator<LdapGroup> iterator = groups.iterator();
    while (iterator.hasNext()) {
        LdapGroup group = iterator.next();
        if (!groupHasUserMembers(group)) {
            iterator.remove();
        }//from  ww  w.  j a v  a 2  s  .c o m
    }
    return groups;
}

From source file:org.apigw.appmanagement.ApplicationManagementAdminServiceImpl.java

@Override
public void removeApplicationCertificate(Long applicationId, Long certificateId) {
    Application application = applicationRepository.findOne(applicationId);
    Set<Certificate> certificates = application.getCertificates();
    Iterator<Certificate> iterator = certificates.iterator();
    while (iterator.hasNext()) {
        Certificate certificate = iterator.next();
        if (certificate.getId().equals(certificateId)) {
            iterator.remove();
            applicationRepository.save(application);
            break;
        }/*www  . j av  a  2  s .  co m*/
    }
}

From source file:ch.puzzle.itc.mobiliar.presentation.util.UserSettings.java

/**
 * Filters the testing properties if the current session is not in testing mode
 * /*from  w  ww  .j a v  a 2 s.c  o  m*/
 * @param listWithTestingProperties
 */
public List<ResourceEditProperty> filterTestingProperties(
        List<ResourceEditProperty> listWithTestingProperties) {
    if (!isTestingMode()) {
        Iterator<ResourceEditProperty> iterator = listWithTestingProperties.iterator();
        while (iterator.hasNext()) {
            ResourceEditProperty p = iterator.next();
            if (p.isTesting()) {
                iterator.remove();
            }
        }
    }
    return listWithTestingProperties;
}

From source file:com.doctor.other.concurrent_hash_map_based_table.ConcurrentHashMapBasedTable.java

/**
 * ?//  ww  w. ja v  a 2s  .  c  o m
 */
public void clear() {
    for (String rowKey : table.keySet()) {
        ConcurrentHashMap<String, ConcurrentSkipListMap<String, ConcurrentSet<T>>> rowMap = table.get(rowKey);
        for (String columnKey : rowMap.keySet()) {
            ConcurrentSkipListMap<String, ConcurrentSet<T>> columnMap = rowMap.get(columnKey);

            Iterator<String> iterator = columnMap.keySet().iterator();
            while (iterator.hasNext()) {
                String timesplices = iterator.next();
                columnMap.get(timesplices).clear();
                iterator.remove();
            }

        }
        rowMap.clear();
    }

    table.clear();
}

From source file:com.muk.services.security.DefaultUaaLoginService.java

private void removeExpiredCookies(List<String> cookies) {
    final Iterator<String> iterator = cookies.iterator();

    while (iterator.hasNext()) {
        final String current = iterator.next();
        if (current.toLowerCase().indexOf("max-age=0") >= 0) {
            iterator.remove();
        }//w  w w.  j  av a 2  s  . c om
    }
}

From source file:de.appsolve.padelcampus.controller.events.GamesController.java

@RequestMapping("/event/{eventId}/team/{teamUUID}")
public ModelAndView getTeamEvents(@PathVariable("teamUUID") String teamUUID,
        @PathVariable("eventId") Long eventId) {
    Event event = eventDAO.findById(eventId);
    Team team = teamDAO.findByUUID(teamUUID);
    List<Game> games = gameDAO.findByParticipantAndEvent(team, event);

    Map<Participant, Map<Game, String>> participantGameResultMap = gameUtil.getParticipantGameResultMap(games,
            true);//from ww  w. j  av  a2 s .  com
    Iterator<Participant> iterator = participantGameResultMap.keySet().iterator();
    while (iterator.hasNext()) {
        Participant p = iterator.next();
        if (!p.equals(team)) {
            iterator.remove();
        }
    }
    ModelAndView mav = new ModelAndView("games/teamgames", "ParticipantGameResultMap",
            participantGameResultMap);
    mav.addObject("title", msg.get("GamesWith", new Object[] { team.toString() }));
    mav.addObject("Model", event);
    return mav;
}

From source file:com.spotify.helios.servicescommon.coordination.PersistentPathChildrenCache.java

private void update() throws KeeperException, InterruptedException {
    log.debug("updating: {}", path);

    final Map<String, T> newSnapshot;
    final Map<String, T> currentSnapshot = snapshot.get();

    if (!synced) {
        synced = true;/*w w  w  . j av  a 2 s.c o  m*/
        newSnapshot = sync();
    } else {
        newSnapshot = Maps.newHashMap(currentSnapshot);
    }

    // Fetch new data and register watchers for updated children
    final Iterator<String> iterator = changes.iterator();
    while (iterator.hasNext()) {
        final String child = iterator.next();
        iterator.remove();
        final String node = ZKPaths.makePath(path, child);
        log.debug("fetching change: {}", node);
        final T value;
        try {
            final byte[] bytes = curator.getData().usingWatcher(dataWatcher).forPath(node);
            value = Json.read(bytes, valueType);
        } catch (KeeperException e) {
            throw e;
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
        newSnapshot.put(node, value);
    }

    if (!currentSnapshot.equals(newSnapshot)) {
        snapshot.setUnchecked(newSnapshot);
        fireNodesChanged();
    }
}

From source file:org.dlut.mycloudserver.service.performancemonitor.PerformanceListener.java

/**
 * monitorConnMap//from   ww w.  ja va  2s. co m
 */
private void refreshMonitorConnMap() {
    Map<Integer, PerformanceMonitorDTO> performanceMonitorMapDB = getPerformanceMonitorMapFromDB();

    Iterator<Map.Entry<Integer, PerformanceMonitorDTO>> it = monitorDTOMap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<Integer, PerformanceMonitorDTO> entry = it.next();
        Integer id = entry.getKey();
        if (!performanceMonitorMapDB.containsKey(id)) {
            it.remove();
        } else {
            performanceMonitorMapDB.remove(id);
        }
    }

    // ??
    for (Integer id : performanceMonitorMapDB.keySet()) {
        monitorDTOMap.put(id, performanceMonitorMapDB.get(id));
    }
}

From source file:pe.gob.mef.gescon.web.ui.PoliticaMB.java

public void cleanAttributes() {
    this.setId(BigDecimal.ZERO);
    this.setModuloid(null);
    this.setDescripcion(StringUtils.EMPTY);
    this.setNombre(StringUtils.EMPTY);
    this.setActivo(BigDecimal.ONE);
    this.setSelectedPolitica(null);
    Iterator<FacesMessage> iter = FacesContext.getCurrentInstance().getMessages();
    if (iter.hasNext() == true) {
        iter.remove();
        FacesContext.getCurrentInstance().renderResponse();
    }/*  w ww .  ja v a 2s . c  om*/
}