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

x33g5p2x  于2022-01-15 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(137)

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

ArrayDeque.iterator介绍

[英]Returns an iterator over the elements in this deque. The elements will be ordered from first (head) to last (tail). This is the same order that elements would be dequeued (via successive calls to #remove or popped (via successive calls to #pop).
[中]返回此数据块中元素的迭代器。元素将从第一个(头部)到最后一个(尾部)排序。这与元素的出列顺序相同(通过连续调用#remove或popped(通过连续调用#pop)。

代码示例

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

@Override
public boolean equals(Object obj) {
  if (obj == this) {
    return true;
  } else if (obj != null && obj.getClass() == ClosableBlockingQueue.class) {
    @SuppressWarnings("unchecked")
    ClosableBlockingQueue<E> that = (ClosableBlockingQueue<E>) obj;
    if (this.elements.size() == that.elements.size()) {
      Iterator<E> thisElements = this.elements.iterator();
      for (E thatNext : that.elements) {
        E thisNext = thisElements.next();
        if (!(thisNext == null ? thatNext == null : thisNext.equals(thatNext))) {
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  } else {
    return false;
  }
}

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

@Override
  public void notifyCheckpointComplete(long checkpointId) throws Exception {
    LOG.debug("Committing Messages externally for checkpoint {}", checkpointId);

    for (Iterator<Tuple2<Long, Set<UId>>> iter = pendingCheckpoints.iterator(); iter.hasNext();) {
      Tuple2<Long, Set<UId>> checkpoint = iter.next();
      long id = checkpoint.f0;

      if (id <= checkpointId) {
        LOG.trace("Committing Messages with following IDs {}", checkpoint.f1);
        acknowledgeIDs(checkpointId, checkpoint.f1);
        // remove deduplication data
        idsProcessedButNotAcknowledged.removeAll(checkpoint.f1);
        // remove checkpoint data
        iter.remove();
      }
      else {
        break;
      }
    }
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onNext(T t) {
  if (index++ % skip == 0) {
    U b;
    try {
      b = ObjectHelper.requireNonNull(bufferSupplier.call(), "The bufferSupplier returned a null collection. Null values are generally not allowed in 2.x operators and sources.");
    } catch (Throwable e) {
      buffers.clear();
      upstream.dispose();
      downstream.onError(e);
      return;
    }
    buffers.offer(b);
  }
  Iterator<U> it = buffers.iterator();
  while (it.hasNext()) {
    U b = it.next();
    b.add(t);
    if (count <= b.size()) {
      it.remove();
      downstream.onNext(b);
    }
  }
}

代码示例来源:origin: prolificinteractive/material-calendarview

CalendarPagerAdapter(MaterialCalendarView mcv) {
 this.mcv = mcv;
 this.today = CalendarDay.today();
 currentViews = new ArrayDeque<>();
 currentViews.iterator();
 setRangeDates(null, null);
}

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

@Override
public void onNext(T t) {
  if (index++ % skip == 0) {
    U b;
    try {
      b = ObjectHelper.requireNonNull(bufferSupplier.call(), "The bufferSupplier returned a null collection. Null values are generally not allowed in 2.x operators and sources.");
    } catch (Throwable e) {
      buffers.clear();
      s.dispose();
      actual.onError(e);
      return;
    }
    buffers.offer(b);
  }
  Iterator<U> it = buffers.iterator();
  while (it.hasNext()) {
    U b = it.next();
    b.add(t);
    if (count <= b.size()) {
      it.remove();
      actual.onNext(b);
    }
  }
}

代码示例来源:origin: aNNiMON/Lightweight-Stream-API

@Override
  public Stream<T> apply(Stream<T> stream) {
    final Iterator<? extends T> iterator = stream.iterator();
    final ArrayDeque<T> deque = new ArrayDeque<T>();
    while (iterator.hasNext()) {
      deque.addFirst(iterator.next());
    }
    return Stream.of(deque.iterator());
  }
}

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

final Iterator<ByteBuffer> iterator = queue.iterator();

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

throw new PoolCancelledException();
for (Iterator<PooledConnection> itr = availableConnections.iterator(); itr.hasNext();) {
 PooledConnection nextConnection = itr.next();
 try {

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

throw new PoolCancelledException();
for (Iterator<PooledConnection> itr = availableConnections.iterator(); itr.hasNext();) {
 PooledConnection nextConnection = itr.next();
 if (!excludedServers.contains(nextConnection.getServer())) {

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
public Iterator<T> iterator() {
  return queue.iterator();
}

代码示例来源:origin: HuaweiBigData/StreamCQL

/**
 * {@inheritDoc}
 */
@Override
public Iterator<TimeEventPair> iterator()
{
  if (null == datas)
  {
    return null;
  }
  
  return datas.iterator();
}

代码示例来源:origin: org.zeromq/jeromq

@Override
public Iterator<ZFrame> iterator()
{
  return frames.iterator();
}

代码示例来源:origin: com.sun.faces/jsf-impl

@Override
public Iterator<E> iterator() {
  return data.iterator();
}

代码示例来源:origin: Qihoo360/Quicksql

public Row receive() {
 try {
  if (iterator == null) {
   iterator = list.iterator();
  }
  return iterator.next();
 } catch (NoSuchElementException e) {
  iterator = null;
  return null;
 }
}

代码示例来源:origin: org.databene/databene-commons

private void remove(File file) {
  Iterator<File> iterator = files.iterator();
  while (iterator.hasNext())
    if (file.equals(iterator.next()))
      iterator.remove();
}

代码示例来源:origin: io.permazen/permazen-kv-simple

@Override
public Boolean parseCommandLineOptions(ArrayDeque<String> options) {
  Boolean config = null;
  for (Iterator<String> i = options.iterator(); i.hasNext(); ) {
    final String option = i.next();
    if (option.equals("--mem")) {
      config = true;
      i.remove();
    }
  }
  return config;
}

代码示例来源:origin: espertechinc/esper

/**
 * Ctor.
 *
 * @param window is the time-slotted collection
 */
public TimeWindowIterator(ArrayDeque<TimeWindowPair> window) {
  super(window.iterator());
  init();
}

代码示例来源:origin: espertechinc/esper

public Iterator<EventBean> iterator() {
  // The merge data view has multiple parent views which are AddPropertyValueView
  ArrayDeque<Iterable<EventBean>> iterables = new ArrayDeque<Iterable<EventBean>>();
  for (View dataView : parentViews) {
    iterables.add(dataView);
  }
  return new IterablesListIterator(iterables.iterator());
}

代码示例来源:origin: org.databene/databene-commons

public void save() {
  Preferences node = Preferences.userNodeForPackage(clazz);
  Iterator<File> iterator = files.iterator();
  for (int i = 0; iterator.hasNext(); i++)
    node.put(RECENT_FILE_PREFIX + i, iterator.next().getAbsolutePath());
  try {
    node.flush();
  } catch (BackingStoreException e) {
    if (!toleratingFailure)
      throw new RuntimeException("Failed to save file history", e);
  }
}

代码示例来源:origin: xbmc/Kore

/**
 * Starts the syncing process
 */
public void startSync() {
  startTime = System.currentTimeMillis();
  hostConnection = new HostConnection(hostInfo);
  hostConnection.setProtocol(HostConnection.PROTOCOL_HTTP);
  syncItemIterator = syncItems.iterator();
  nextSync();
}

相关文章