java.util.LinkedList.iterator()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中java.util.LinkedList.iterator()方法的一些代码示例,展示了LinkedList.iterator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.iterator()方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:iterator

LinkedList.iterator介绍

暂无

代码示例

代码示例来源:origin: hankcs/HanLP

/**
 * 获取某一行的第一个节点
 *
 * @param line
 * @return
 */
public Vertex getFirst(int line)
{
  Iterator<Vertex> iterator = vertexes[line].iterator();
  if (iterator.hasNext()) return iterator.next();
  return null;
}

代码示例来源:origin: redisson/redisson

private static void addClass(LinkedList list, CtClass c) {
  Iterator it = list.iterator();
  while (it.hasNext())
    if (it.next() == c)
      return;
  list.add(c);
}

代码示例来源:origin: com.sun.jersey/jersey-server

public static Variant selectVariant(ContainerRequest r, List<Variant> variants) {
    LinkedList<VariantHolder> vhs = getVariantHolderList(variants);

    Set<String> vary = new HashSet<String>();
    vhs = selectVariants(vhs, HttpHelper.getAccept(r), MEDIA_TYPE_DC, vary);
    vhs = selectVariants(vhs, HttpHelper.getAcceptLanguage(r), LANGUAGE_TAG_DC, vary);
    vhs = selectVariants(vhs, HttpHelper.getAcceptCharset(r), CHARSET_DC, vary);
    vhs = selectVariants(vhs, HttpHelper.getAcceptEncoding(r), ENCODING_DC, vary);

    if (vhs.isEmpty()) {
      return null;
    } else {
      StringBuilder varyHeader = new StringBuilder();
      for (String v : vary) {
        if (varyHeader.length() > 0) {
          varyHeader.append(',');
        }
        varyHeader.append(v);
      }
      r.getProperties().put(ContainerRequest.VARY_HEADER, varyHeader.toString());
      return vhs.iterator().next().v;
    }
  }
}

代码示例来源:origin: Sable/soot

while (asgit.hasNext()) {
 AugmentedStmt as = (AugmentedStmt) asgit.next();
 Iterator tsit = tSuccList.iterator();
 while (tsit.hasNext()) {
  AugmentedStmt tSucc = (AugmentedStmt) tsit.next();
  AugmentedStmt target = (AugmentedStmt) tSucc2target.get(tSucc);
  worklist.addAll(sng.getHeads());
  while (worklist.isEmpty() == false) {
   SwitchNode sn = (SwitchNode) worklist.removeFirst();
   Iterator sit = sn.get_Succs().iterator();
   while (sit.hasNext()) {
    SwitchNode ssn = (SwitchNode) sit.next();

代码示例来源:origin: crashub/crash

public void send() throws IOException {
  if (buffer.size() > 0) {
   LineRenderer renderer = renderable.renderer(buffer.iterator());
   renderer.render(out);
   buffer.clear();
   renderable = null;
  }
 }
}

代码示例来源:origin: hankcs/HanLP

/**
 * 强行添加,替换已有的顶点
 *
 * @param line
 * @param vertex
 */
public void push(int line, Vertex vertex)
{
  Iterator<Vertex> iterator = vertexes[line].iterator();
  while (iterator.hasNext())
  {
    if (iterator.next().realWord.length() == vertex.realWord.length())
    {
      iterator.remove();
      --size;
      break;
    }
  }
  vertexes[line].add(vertex);
  ++size;
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Create a new <code>FastByteArrayOutputStreamInputStream</code> backed
 * by the given <code>FastByteArrayOutputStream</code>.
 */
public FastByteArrayInputStream(FastByteArrayOutputStream fastByteArrayOutputStream) {
  this.fastByteArrayOutputStream = fastByteArrayOutputStream;
  this.buffersIterator = fastByteArrayOutputStream.buffers.iterator();
  if (this.buffersIterator.hasNext()) {
    this.currentBuffer = this.buffersIterator.next();
    if (this.currentBuffer == fastByteArrayOutputStream.buffers.getLast()) {
      this.currentBufferLength = fastByteArrayOutputStream.index;
    }
    else {
      this.currentBufferLength = (this.currentBuffer != null ? this.currentBuffer.length : 0);
    }
  }
}

代码示例来源:origin: apache/storm

private void checkFutures() {
  Iterator<Future<Void>> i = _futures.iterator();
  while (i.hasNext()) {
    Future<Void> f = i.next();
    if (f.isDone()) {
      i.remove();
    }
    try {
      f.get();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * Write the buffers content to the given OutputStream.
 * @param out the OutputStream to write to
 */
public void writeTo(OutputStream out) throws IOException {
  Iterator<byte[]> it = this.buffers.iterator();
  while (it.hasNext()) {
    byte[] bytes = it.next();
    if (it.hasNext()) {
      out.write(bytes, 0, bytes.length);
    }
    else {
      out.write(bytes, 0, this.index);
    }
  }
}

代码示例来源:origin: FudanNLP/fnlp

public int getSentenceNum() {
  Iterator<FNLPDoc> it1 = docs.iterator();
  int n=0;
  while(it1.hasNext()){
    FNLPDoc doc = it1.next();
    n += doc.sentences.size();
  }
  return n;
}

代码示例来源:origin: apache/storm

public void put(K key, V value) {
  Iterator<HashMap<K, V>> it = _buckets.iterator();
  HashMap<K, V> bucket = it.next();
  bucket.put(key, value);
  while (it.hasNext()) {
    bucket = it.next();
    bucket.remove(key);
  }
}

代码示例来源:origin: scouter-project/scouter

private static void addClass(LinkedList list, CtClass c) {
  Iterator it = list.iterator();
  while (it.hasNext())
    if (it.next() == c)
      return;
  list.add(c);
}

代码示例来源:origin: alibaba/jstorm

public void put(K key, V value) {
  synchronized (_lock) {
    Iterator<HashMap<K, V>> it = _buckets.iterator();
    HashMap<K, V> bucket = it.next();
    bucket.put(key, value);
    while (it.hasNext()) {
      bucket = it.next();
      bucket.remove(key);
    }
  }
}

代码示例来源:origin: osmandapp/Osmand

public void removeDownloaderCallback(IMapDownloaderCallback callback) {
  LinkedList<WeakReference<IMapDownloaderCallback>> ncall = new LinkedList<WeakReference<IMapDownloaderCallback>>(callbacks);
  Iterator<WeakReference<IMapDownloaderCallback>> it = ncall.iterator();
  while (it.hasNext()) {
    IMapDownloaderCallback c = it.next().get();
    if (c == callback) {
      it.remove();
    }
  }
  callbacks = ncall;
}

代码示例来源:origin: alibaba/jstorm

public void put(K key, V value) {
  Iterator<HashMap<K, V>> it = _buckets.iterator();
  HashMap<K, V> bucket = it.next();
  bucket.put(key, value);
  while (it.hasNext()) {
    bucket = it.next();
    bucket.remove(key);
  }
}

代码示例来源:origin: jfinal/jfinal

public static synchronized void removeFieldGetter(Class<? extends FieldGetter> fieldGetterClass) {
    LinkedList<FieldGetter> ret = getCurrentFieldGetters();
    
    for (Iterator<FieldGetter> it = ret.iterator(); it.hasNext();) {
      if (it.next().getClass() == fieldGetterClass) {
        it.remove();
      }
    }
    
    getters = ret.toArray(new FieldGetter[ret.size()]);
  }
}

代码示例来源:origin: alibaba/jstorm

@Override
public void put(K key, V value) {
  synchronized (lock) {
    Iterator<HashMap<K, V>> it = buckets.iterator();
    HashMap<K, V> bucket = it.next();
    bucket.put(key, value);
    while (it.hasNext()) {
      bucket = it.next();
      bucket.remove(key);
    }
  }
}

代码示例来源:origin: alibaba/canal

private void filter(String hostInstanceId) {
  Iterator<BinlogFile> it = binlogList.iterator();
  while (it.hasNext()) {
    BinlogFile bf = it.next();
    if (bf.getHostInstanceID().equalsIgnoreCase(hostInstanceId)) {
      it.remove();
    } else {
      hostId = bf.getHostInstanceID();
    }
  }
}

代码示例来源:origin: prestodb/presto

protected void _appendPathDesc(StringBuilder sb)
  {
    if (_path == null) {
      return;
    }
    Iterator<Reference> it = _path.iterator();
    while (it.hasNext()) {
      sb.append(it.next().toString());
      if (it.hasNext()) {
        sb.append("->");
      }
    }
  }
}

代码示例来源:origin: org.mongodb/mongo-java-driver

@Override
public void close() {
  isClosed = true;
  if (channel != null) {
    channel.close();
    channel = null;
  }
  for (Iterator<io.netty.buffer.ByteBuf> iterator = pendingInboundBuffers.iterator(); iterator.hasNext();) {
    io.netty.buffer.ByteBuf nextByteBuf = iterator.next();
    iterator.remove();
    nextByteBuf.release();
  }
}

相关文章