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:de.micromata.genome.chronos.spi.ReservedJobs.java

/**
 * Removes the job./*from  w  ww  .j ava2s  .co m*/
 *
 * @param it the it
 * @param job the job
 */
public void removeJob(final Iterator<TriggerJobDO> it, final TriggerJobDO job) {
    jobsByPk.remove(job.getPk());
    it.remove();
}

From source file:io.cloudslang.engine.data.SqlInQueryReader.java

private Set<String> extractAndRemoveUpToLimit(Set<String> source, int limit) {
    Set<String> result = new HashSet<>();
    Iterator<String> iterator = source.iterator();
    while (iterator.hasNext() && result.size() < limit) {
        result.add(iterator.next());//from  w w w.j av  a 2  s .  c om
        iterator.remove();
    }
    return result;
}

From source file:com.baasbox.controllers.User.java

static String prepareResponseToJson(List<ODocument> listOfDoc) {
    response().setContentType("application/json");
    try {//from   w  ww  .  j  av  a2 s .  c  o  m
        for (ODocument doc : listOfDoc) {
            doc.detach();
            if (doc.field("user") instanceof ODocument) {
                OMVRBTreeRIDSet roles = ((ODocument) doc.field("user")).field("roles");
                if (roles.size() > 1) {
                    Iterator<OIdentifiable> it = roles.iterator();
                    while (it.hasNext()) {
                        if (((ODocument) it.next().getRecord()).field("name").toString()
                                .startsWith(FriendShipService.FRIEND_ROLE_NAME)) {
                            it.remove();
                        }
                    }
                }
            }
        }
        return JSONFormats.prepareResponseToJson(listOfDoc, JSONFormats.Formats.USER);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.bdaum.zoom.report.internal.jfree.custom.SparseCategoryAxis.java

@SuppressWarnings("rawtypes")
@Override/*from   w w w . j a  v a  2 s  .c o m*/
public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = super.refreshTicks(g2, state, dataArea, edge);
    Iterator iterator = ticks.iterator();
    int i = 0;
    while (iterator.hasNext()) {
        iterator.next();
        if (i++ % nth != 0)
            iterator.remove();
    }
    return ticks;
}

From source file:com.textocat.textokit.eval.anno.impl.OverlapMatchingStrategy.java

@Override
public Set<AnnotationFS> searchCandidates(AnnotationFS goldAnno) {
    Set<AnnotationFS> result = sysOverlapIdx.getOverlapping(goldAnno.getBegin(), goldAnno.getEnd());
    Iterator<AnnotationFS> resultIter = result.iterator();
    while (resultIter.hasNext()) {
        if (!isCandidate(goldAnno, resultIter.next())) {
            resultIter.remove();
        }//from  w w w. j a  va  2 s.c om
    }
    return result;
}

From source file:facade.collections.CollectionInPlaceProxy.java

public CollectionProxy<T> select(Predicate<T> pred) {
    Iterator<T> it = collection.iterator();
    while (it.hasNext()) {
        T t = it.next();/* w  w w  . j  av a  2 s  .  c  om*/
        if (!pred.evaluate(t)) {
            it.remove();
        }
    }
    return this;
}

From source file:com.kenai.redminenb.repository.RedmineRepository.java

public static RedmineRepository getInstanceyById(@NonNull String id) {
    if (id == null) {
        throw new NullPointerException("getInstanceById might not be called with null!");
    }//w ww  .ja  va  2s. co m
    synchronized (repositoryList) {
        Iterator<WeakReference<RedmineRepository>> it = repositoryList.iterator();
        RedmineRepository result = null;
        while (it.hasNext()) {
            WeakReference<RedmineRepository> weak = it.next();
            RedmineRepository hard = weak.get();
            if (hard == null) {
                it.remove();
            } else {
                if (id.equals(hard.getID()) && result == null) {
                    result = hard;
                }
            }
        }
        return result;
    }
}

From source file:IndexedSet.java

@Override
public boolean retainAll(Collection<?> c) {
    boolean removed = false;
    Iterator<T> it = list.iterator();
    while (it.hasNext()) {
        T next = it.next();/*w  w  w. j a v  a  2 s .co  m*/
        if (!c.contains(next)) {
            it.remove();
            set.remove(it);
            removed = true;
        }
    }
    return removed;
}

From source file:com.cyberway.issue.queue.MemQueue.java

/**
 * @see com.cyberway.issue.queue.Queue#deleteMatchedItems(org.apache.commons.collections.Predicate)
 *///from  w ww. ja v a  2  s  .c  o  m
public long deleteMatchedItems(Predicate matcher) {
    Iterator<T> it = listIterator();
    long numberOfDeletes = 0;
    while (it.hasNext()) {
        if (matcher.evaluate(it.next())) {
            it.remove();
            numberOfDeletes++;
        }
    }
    return numberOfDeletes;
}

From source file:net.lmxm.ute.gui.components.FilesTableModel.java

/**
 * Clean row data./*from  w w  w . j a  va  2 s  .c o m*/
 */
private void cleanRowData() {
    final Iterator<FileReference> iterator = rowData.iterator();
    while (iterator.hasNext()) {
        if (iterator.next().isEmpty()) {
            iterator.remove();
        }
    }

    rowData.add(new FileReference());
}