当前位置: 首页>>代码示例>>Java>>正文


Java ListIterator.remove方法代码示例

本文整理汇总了Java中java.util.ListIterator.remove方法的典型用法代码示例。如果您正苦于以下问题:Java ListIterator.remove方法的具体用法?Java ListIterator.remove怎么用?Java ListIterator.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ListIterator的用法示例。


在下文中一共展示了ListIterator.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: put

import java.util.ListIterator; //导入方法依赖的package包/类
public synchronized void put (String pkey, AuthCacheValue value) {
    LinkedList<AuthCacheValue> list = hashtable.get (pkey);
    String skey = value.getPath();
    if (list == null) {
        list = new LinkedList<AuthCacheValue>();
        hashtable.put(pkey, list);
    }
    // Check if the path already exists or a super-set of it exists
    ListIterator<AuthCacheValue> iter = list.listIterator();
    while (iter.hasNext()) {
        AuthenticationInfo inf = (AuthenticationInfo)iter.next();
        if (inf.path == null || inf.path.startsWith (skey)) {
            iter.remove ();
        }
    }
    iter.add(value);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:AuthCacheImpl.java

示例2: getIterator

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Returns an iterator for the specified glyphs, sorted either ascending or descending.
 * 
 * @param glyphs The glyphs to return if present
 * @return An iterator of the sorted list of glyphs
 */
private Iterator getIterator(List glyphs) {
	if (orderAscending) return glyphs.iterator();
	final ListIterator iter = glyphs.listIterator(glyphs.size());
	return new Iterator() {
		public boolean hasNext () {
			return iter.hasPrevious();
		}

		public Object next () {
			return iter.previous();
		}

		public void remove () {
			iter.remove();
		}
	};
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:GlyphPage.java

示例3: update

import java.util.ListIterator; //导入方法依赖的package包/类
public ListIterator<T> update() {
	ListIterator<T> ia = add.listIterator();
	ListIterator<T> ir = add.listIterator();
	
	while (ia.hasNext()) {
		values.add(ia.next());
		ia.remove();
	}
	
	while (ir.hasNext()) {
		values.remove(ir.next());
		ir.remove();
	}
	
	return values.listIterator();
}
 
开发者ID:GigaGamma,项目名称:McLink,代码行数:17,代码来源:LoopUtil.java

示例4: removeFromExpiryList

import java.util.ListIterator; //导入方法依赖的package包/类
synchronized void removeFromExpiryList(HttpConnection c) {
    if (c == null) {
        return;
    }
    ListIterator<ExpiryEntry> li = expiryList.listIterator();
    while (li.hasNext()) {
        ExpiryEntry e = li.next();
        if (e.connection.equals(c)) {
            li.remove();
            return;
        }
    }
    CacheCleaner cleaner = this.cleanerRef.get();
    if (expiryList.isEmpty() && cleaner != null) {
        this.cleanerRef.compareAndSet(cleaner, null);
        cleaner.stopCleaner();
        cleaner.interrupt();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ConnectionPool.java

示例5: match

import java.util.ListIterator; //导入方法依赖的package包/类
private void match(ListIterator<Match<T>> lit) {
	Match<T> m = lit.next();
	State<T> state = m.getState();
	m.setMatched(false);
	match(lit, m, state);
	if (skipSearch) {
		if (m.isMatched())
			lit.add(m.spawn(state));
		else if (state == trie.getRoot())
			lit.remove();
	}
	else {
		if (!m.isMatched())
			lit.remove();
	}
}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:17,代码来源:Matcher.java

示例6: threadSafeRemove

import java.util.ListIterator; //导入方法依赖的package包/类
public synchronized void threadSafeRemove(@NonNull final IThreadSafeConditions<T> conditions) {

        if (conditions == null) {
            throw new IllegalArgumentException("conditions cannot be null");
        }

        /*
         * Remove everything except PivotsRV
         *
         * Use iterator to avoid ConcurrentModificationException
         */
        ListIterator<T> iterator = getList().listIterator();
        final Stack<Integer> positions = new Stack<>();
        int position;
        T item;
        while (iterator.hasNext()) {
            position = iterator.nextIndex();
            item = iterator.next();
            if (conditions.removeIf(item)) {
                iterator.remove();
                positions.push(position);
            }
        }
        conditions.onItemsRemoved(positions);
    }
 
开发者ID:Tenor-Inc,项目名称:tenor-android-core,代码行数:26,代码来源:ListRVAdapter.java

示例7: findSendablePacket

import java.util.ListIterator; //导入方法依赖的package包/类
private Packet findSendablePacket(LinkedList<Packet> outgoingQueue,
                                  boolean clientTunneledAuthenticationInProgress) {
    synchronized (outgoingQueue) {
        if (outgoingQueue.isEmpty()) {
            return null;
        }
        if (outgoingQueue.getFirst().bb != null // If we've already starting sending the first packet, we better finish
            || !clientTunneledAuthenticationInProgress) {
            return outgoingQueue.getFirst();
        }

        // Since client's authentication with server is in progress,
        // send only the null-header packet queued by primeConnection().
        // This packet must be sent so that the SASL authentication process
        // can proceed, but all other packets should wait until
        // SASL authentication completes.
        ListIterator<Packet> iter = outgoingQueue.listIterator();
        while (iter.hasNext()) {
            Packet p = iter.next();
            if (p.requestHeader == null) {
                // We've found the priming-packet. Move it to the beginning of the queue.
                iter.remove();
                outgoingQueue.add(0, p);
                return p;
            } else {
                // Non-priming packet: defer it until later, leaving it in the queue
                // until authentication completes.
                if (LOG.isDebugEnabled()) {
                    LOG.debug("deferring non-priming packet: " + p +
                            "until SASL authentication completes.");
                }
            }
        }
        // no sendable packet found.
        return null;
    }
}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:38,代码来源:ClientCnxnSocketNIO.java

示例8: removeMultiplePeaks

import java.util.ListIterator; //导入方法依赖的package包/类
public PeakList removeMultiplePeaks() {
    // TODO (LS) :
    ListIterator<Peak> peakListIterator = this.pList.listIterator();

    while (peakListIterator.hasNext()) {
        int index = peakListIterator.nextIndex();
        Peak currentPeak = peakListIterator.next();
        for (int j = 0; j < index; ++j) {
            if (currentPeak.equalsPeak(this.pList.get(j))) {
                peakListIterator.remove();
                break; // TODO why break ?
            }
        }
    }

    return this;
}
 
开发者ID:protViz,项目名称:deisotoper,代码行数:18,代码来源:PeakList.java

示例9: get

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Returns a recycled connection to {@code address}, or null if no such connection exists.
 */
synchronized Connection get(Endpoint endpoint) {

    /*
    * Iterate the connections in reverse order
    * and take the first connection having the same endpoint.
    * */
    ListIterator<Connection> iterator = connections.listIterator(connections.size());
    while (iterator.hasPrevious()) {
        Connection connection = iterator.previous();
        if (connection.endpoint().equals(endpoint)) {
            iterator.remove();
            return connection;
        }
    }

    return null;
}
 
开发者ID:pCloud,项目名称:pcloud-networking-java,代码行数:21,代码来源:ConnectionPool.java

示例10: compress

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Try to remove extraneous items from the set of sampled items. This checks
 * if an item is unnecessary based on the desired error bounds, and merges it
 * with the adjacent item if it is.
 */
private void compress() {
  if (samples.size() < 2) {
    return;
  }

  ListIterator<SampleItem> it = samples.listIterator();
  SampleItem prev = null;
  SampleItem next = it.next();

  while (it.hasNext()) {
    prev = next;
    next = it.next();
    if (prev.g + next.g + next.delta <= allowableError(it.previousIndex())) {
      next.g += prev.g;
      // Remove prev. it.remove() kills the last thing returned.
      it.previous();
      it.previous();
      it.remove();
      // it.next() is now equal to next, skip it back forward again
      it.next();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:SampleQuantiles.java

示例11: optimizeTasksLocked

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * App started in VA may be removed in OverView screen, then AMS.removeTask
 * will be invoked, all data struct about the task in AMS are released,
 * while the client's process is still alive. So remove related data in VA
 * as well. A new TaskRecord will be recreated in `onActivityCreated`
 */
private void optimizeTasksLocked() {
    // noinspection deprecation
    ArrayList<ActivityManager.RecentTaskInfo> recentTask = new ArrayList<>(mAM.getRecentTasks(Integer.MAX_VALUE,
            ActivityManager.RECENT_WITH_EXCLUDED | ActivityManager.RECENT_IGNORE_UNAVAILABLE));
    int N = mHistory.size();
    while (N-- > 0) {
        TaskRecord task = mHistory.valueAt(N);
        ListIterator<ActivityManager.RecentTaskInfo> iterator = recentTask.listIterator();
        boolean taskAlive = false;
        while (iterator.hasNext()) {
            ActivityManager.RecentTaskInfo info = iterator.next();
            if (info.id == task.taskId) {
                taskAlive = true;
                iterator.remove();
                break;
            }
        }
        if (!taskAlive) {
            mHistory.removeAt(N);
        }
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:29,代码来源:ActivityStack.java

示例12: dequeueKeyEvents

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Releases for normal dispatching to the current focus owner all
 * KeyEvents which were enqueued because of a call to
 * {@code enqueueKeyEvents} with the same timestamp and Component.
 * If the given timestamp is less than zero, the outstanding enqueue
 * request for the given Component with the <b>oldest</b> timestamp (if
 * any) should be cancelled.
 *
 * @param after the timestamp specified in the call to
 *        {@code enqueueKeyEvents}, or any value &lt; 0
 * @param untilFocused the Component specified in the call to
 *        {@code enqueueKeyEvents}
 * @see #enqueueKeyEvents
 * @see #discardKeyEvents
 */
protected synchronized void dequeueKeyEvents(long after,
                                             Component untilFocused) {
    if (untilFocused == null) {
        return;
    }

    if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
        focusLog.finer("Dequeue at {0} for {1}",
                   after, untilFocused);
    }

    TypeAheadMarker marker;
    ListIterator<TypeAheadMarker> iter = typeAheadMarkers.listIterator
        ((after >= 0) ? typeAheadMarkers.size() : 0);

    if (after < 0) {
        while (iter.hasNext()) {
            marker = iter.next();
            if (marker.untilFocused == untilFocused)
            {
                iter.remove();
                return;
            }
        }
    } else {
        while (iter.hasPrevious()) {
            marker = iter.previous();
            if (marker.untilFocused == untilFocused &&
                marker.after == after)
            {
                iter.remove();
                return;
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:52,代码来源:DefaultKeyboardFocusManager.java

示例13: resetOffset

import java.util.ListIterator; //导入方法依赖的package包/类
public boolean resetOffset(long offset) {
    MappedFile mappedFileLast = getLastMappedFile();

    if (mappedFileLast != null) {
        long lastOffset = mappedFileLast.getFileFromOffset() +
            mappedFileLast.getWrotePosition();
        long diff = lastOffset - offset;

        final int maxDiff = this.mappedFileSize * 2;
        if (diff > maxDiff)
            return false;
    }

    ListIterator<MappedFile> iterator = this.mappedFiles.listIterator();

    while (iterator.hasPrevious()) {
        mappedFileLast = iterator.previous();
        if (offset >= mappedFileLast.getFileFromOffset()) {
            int where = (int) (offset % mappedFileLast.getFileSize());
            mappedFileLast.setFlushedPosition(where);
            mappedFileLast.setWrotePosition(where);
            mappedFileLast.setCommittedPosition(where);
            break;
        } else {
            iterator.remove();
        }
    }
    return true;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:30,代码来源:MappedFileQueue.java

示例14: listIterator_remove_nonRealmList_throwUnsupported

import java.util.ListIterator; //导入方法依赖的package包/类
@Test
public void listIterator_remove_nonRealmList_throwUnsupported() {
    if (skipTest(CollectionClass.MANAGED_REALMLIST, CollectionClass.UNMANAGED_REALMLIST)) {
       return;
    }
    ListIterator<AllJavaTypes> it = collection.listIterator();
    AllJavaTypes obj = it.next();
    assertEquals("test data 0", obj.getFieldString());
    realm.beginTransaction();
    thrown.expect(UnsupportedOperationException.class);
    it.remove();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:OrderedRealmCollectionIteratorTests.java

示例15: removeBeforeNext

import java.util.ListIterator; //导入方法依赖的package包/类
@Test
public void removeBeforeNext() {
  IRCode code = simpleCode();

  ListIterator<BasicBlock> blocks = code.listIterator();
  ListIterator<Instruction> instructions = blocks.next().listIterator();
  thrown.expect(IllegalStateException.class);
  instructions.remove();
}
 
开发者ID:inferjay,项目名称:r8,代码行数:10,代码来源:InstructionIteratorTest.java


注:本文中的java.util.ListIterator.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。