Tabnine Logo
ArrayList.iterator
Code IndexAdd Tabnine to your IDE (free)

How to use
iterator
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.iterator (Showing top 20 results out of 20,898)

Refine searchRefine arrow

  • Iterator.hasNext
  • Iterator.next
  • ArrayList.add
  • ArrayList.<init>
  • ArrayList.size
origin: jenkinsci/jenkins

@Override
public boolean hasNext() {
  while ((delegate == null || !delegate.hasNext()) && (providers.hasNext())) {
    final QueueItemAuthenticatorProvider provider = providers.next();
    if (provider == null) {
      continue;
    }
    delegate = new ArrayList<QueueItemAuthenticator>(provider.getAuthenticators()).iterator();
  }
  return delegate != null && delegate.hasNext();
}
origin: apache/storm

private Iterator<Long> getIds() {
  try {
    partitionIdsLock.lock();
    LOG.debug("Iterator partitionIds: {}", partitionIds);
    return new ArrayList<>(partitionIds).iterator();
  } finally {
    partitionIdsLock.unlock();
  }
}
origin: alibaba/jstorm

@Override
public TaskMessage next() {
  TaskMessage msg;
  if (iter.hasNext()) {
    msg = iter.next();
  } else {
    bundleOffset++;
    iter = bundle.get(bundleOffset).iterator();
    msg = iter.next();
  }
  if (null != msg) {
    offset++;
  }
  return msg;
}
origin: apache/storm

protected Iterator<String> listKeys(Path path) throws IOException {
  ArrayList<String> ret = new ArrayList<String>();
  FileStatus[] files = _fs.listStatus(new Path[]{path});
  if (files != null) {
    for (FileStatus sub : files) {
      try {
        ret.add(sub.getPath().getName().toString());
      } catch (IllegalArgumentException e) {
        //Ignored the file did not match
        LOG.debug("Found an unexpected file in {} {}", path, sub.getPath().getName());
      }
    }
  }
  return ret.iterator();
}
origin: apache/hbase

@Test
public void testUnsecure() throws ZooKeeperConnectionException, IOException {
 Configuration conf = HBaseConfiguration.create();
 conf.set(Superusers.SUPERUSER_CONF_KEY, "user1");
 String node = "/hbase/testUnsecure";
 ZKWatcher watcher = new ZKWatcher(conf, node, null, false);
 List<ACL> aclList = ZKUtil.createACL(watcher, node, false);
 assertEquals(1, aclList.size());
 assertTrue(aclList.contains(Ids.OPEN_ACL_UNSAFE.iterator().next()));
}
origin: google/guava

public void testIndexOf_consumedDataNoMatch() {
 Iterator<String> iterator = Lists.newArrayList("manny", "mo", "mo", "jack").iterator();
 assertEquals(-1, Iterators.indexOf(iterator, Predicates.equalTo("bob")));
 assertFalse(iterator.hasNext());
}
origin: apache/activemq

public MessageAck[] getAcks() {
  ArrayList<Object> list = new ArrayList<Object>();
  for (Iterator<TxOperation> iter = operations.iterator(); iter.hasNext();) {
    TxOperation op = iter.next();
    if (op.operationType == TxOperation.REMOVE_OPERATION_TYPE) {
      list.add(op.data);
    }
  }
  MessageAck rc[] = new MessageAck[list.size()];
  list.toArray(rc);
  return rc;
}
origin: apache/storm

protected Iterator<LocalFsBlobStoreFile> listBlobStoreFiles(File path) throws IOException {
  ArrayList<LocalFsBlobStoreFile> ret = new ArrayList<LocalFsBlobStoreFile>();
  File[] files = path.listFiles();
  if (files != null) {
    for (File sub : files) {
      try {
        ret.add(new LocalFsBlobStoreFile(sub.getParentFile(), sub.getName()));
      } catch (IllegalArgumentException e) {
        //Ignored the file did not match
        LOG.warn("Found an unexpected file in {} {}", path, sub.getName());
      }
    }
  }
  return ret.iterator();
}
origin: libgdx/libgdx

private ArrayList<JniSection> getNativeCodeBodies (String classFile) {
  ArrayList<JniSection> sections = getComments(classFile);
  Iterator<JniSection> iter = sections.iterator();
  while (iter.hasNext()) {
    JniSection section = iter.next();
    if (section.getNativeCode().startsWith("JNI")) iter.remove();
    if (section.getNativeCode().startsWith("-{")) iter.remove();
    if (!CustomIgnoreTag.isEmpty() && section.getNativeCode().startsWith(CustomIgnoreTag)) iter.remove();
  }
  return sections;
}
origin: JetBrains/ideavim

@NotNull
@Override
public Iterator<List<KeyStroke>> iterator() {
 return new ArrayList<List<KeyStroke>>(myKeys.keySet()).iterator();
}
origin: apache/hbase

@Test
public void testSecuritySingleSuperuser() throws ZooKeeperConnectionException, IOException {
 Configuration conf = HBaseConfiguration.create();
 conf.set(Superusers.SUPERUSER_CONF_KEY, "user1");
 String node = "/hbase/testSecuritySingleSuperuser";
 ZKWatcher watcher = new ZKWatcher(conf, node, null, false);
 List<ACL> aclList = ZKUtil.createACL(watcher, node, true);
 assertEquals(2, aclList.size()); // 1+1, since ACL will be set for the creator by default
 assertTrue(aclList.contains(new ACL(Perms.ALL, new Id("sasl", "user1"))));
 assertTrue(aclList.contains(Ids.CREATOR_ALL_ACL.iterator().next()));
}
origin: apache/activemq

public Message[] getMessages() {
  ArrayList<Object> list = new ArrayList<Object>();
  for (Iterator<TxOperation> iter = operations.iterator(); iter.hasNext();) {
    TxOperation op = iter.next();
    if (op.operationType == TxOperation.ADD_OPERATION_TYPE) {
      list.add(op.data);
    }
  }
  Message rc[] = new Message[list.size()];
  list.toArray(rc);
  return rc;
}
origin: apache/storm

protected Iterator<BlobStoreFile> listBlobStoreFiles(Path path) throws IOException {
  ArrayList<BlobStoreFile> ret = new ArrayList<BlobStoreFile>();
  FileStatus[] files = _fs.listStatus(new Path[]{path});
  if (files != null) {
    for (FileStatus sub : files) {
      try {
        ret.add(new HdfsBlobStoreFile(sub.getPath().getParent(), sub.getPath().getName(),
            _hadoopConf));
      } catch (IllegalArgumentException e) {
        //Ignored the file did not match
        LOG.warn("Found an unexpected file in {} {}", path, sub.getPath().getName());
      }
    }
  }
  return ret.iterator();
}
origin: libgdx/libgdx

private ArrayList<JniSection> getNativeCodeBodies (String classFile) {
  ArrayList<JniSection> sections = getComments(classFile);
  Iterator<JniSection> iter = sections.iterator();
  while (iter.hasNext()) {
    JniSection section = iter.next();
    if (section.getNativeCode().startsWith("JNI")) iter.remove();
    if (section.getNativeCode().startsWith("-{")) iter.remove();
    if (!CustomIgnoreTag.isEmpty() && section.getNativeCode().startsWith(CustomIgnoreTag)) iter.remove();
  }
  return sections;
}
origin: commons-collections/commons-collections

public Iterator makeEmptyIterator() {
  ArrayList list = new ArrayList();
  return new IteratorChain(list.iterator());
}
origin: AltBeacon/android-beacon-library

private synchronized void refreshMeasurements() {
  ArrayList<Measurement> newMeasurements = new ArrayList<Measurement>();
  Iterator<Measurement> iterator = mMeasurements.iterator();
  while (iterator.hasNext()) {
    Measurement measurement = iterator.next();
    if (SystemClock.elapsedRealtime() - measurement.timestamp < sampleExpirationMilliseconds ) {
      newMeasurements.add(measurement);
    }
  }
  mMeasurements = newMeasurements;
  Collections.sort(mMeasurements);
}
origin: alibaba/jstorm

protected Iterator<LocalFsBlobStoreFile> listBlobStoreFiles(File path) throws IOException {
  ArrayList<LocalFsBlobStoreFile> ret = new ArrayList<LocalFsBlobStoreFile>();
  File[] files = path.listFiles();
  if (files != null) {
    for (File sub: files) {
      try {
        ret.add(new LocalFsBlobStoreFile(sub.getParentFile(), sub.getName()));
      } catch (IllegalArgumentException e) {
        //Ignored the file did not match
        LOG.warn("Found an unexpected file in {} {}",path, sub.getName());
      }
    }
  }
  return ret.iterator();
}
origin: redisson/redisson

protected String getExpressionSetSummary(java.util.ArrayList<Integer> list) {
  if (list.contains(NO_SPEC)) {
    return "?";
  }
  if (list.contains(ALL_SPEC)) {
    return "*";
  }
  StringBuilder buf = new StringBuilder();
  Iterator<Integer> itr = list.iterator();
  boolean first = true;
  while (itr.hasNext()) {
    Integer iVal = itr.next();
    String val = iVal.toString();
    if (!first) {
      buf.append(",");
    }
    buf.append(val);
    first = false;
  }
  return buf.toString();
}
origin: commons-collections/commons-collections

public Iterator makeEmptyIterator() {
  ArrayList list = new ArrayList();
  return new ObjectGraphIterator(list.iterator(), null);
}
origin: Sable/soot

public void addMetric(MetricData data) {
 Iterator<MetricData> it = metricData.iterator();
 while (it.hasNext()) {
  MetricData temp = it.next();
  if (temp.metricName.equals(data.metricName)) {
   // System.out.println("Not adding same metric again......"+temp.metricName);
   return;
  }
 }
 metricData.add(data);
}
java.utilArrayListiterator

Javadoc

Returns an iterator over the elements in this list in proper sequence.

The returned iterator is fail-fast.

Popular methods of ArrayList

  • <init>
  • add
  • size
    Returns the number of elements in this ArrayList.
  • get
    Returns the element at the specified position in this list.
  • toArray
    Returns an array containing all of the elements in this list in proper sequence (from first to last
  • addAll
    Adds the objects in the specified collection to this ArrayList.
  • remove
    Removes the first occurrence of the specified element from this list, if it is present. If the list
  • clear
    Removes all elements from this ArrayList, leaving it empty.
  • isEmpty
    Returns true if this list contains no elements.
  • contains
    Searches this ArrayList for the specified object.
  • set
    Replaces the element at the specified position in this list with the specified element.
  • indexOf
    Returns the index of the first occurrence of the specified element in this list, or -1 if this list
  • set,
  • indexOf,
  • clone,
  • subList,
  • stream,
  • ensureCapacity,
  • trimToSize,
  • removeAll,
  • toString

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now