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

How to use
listIterator
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.listIterator (Showing top 20 results out of 2,475)

Refine searchRefine arrow

  • ListIterator.hasNext
  • ListIterator.next
origin: redisson/redisson

static AttributeInfo lookup(ArrayList list, String name) {
  if (list == null)
    return null;
  ListIterator iterator = list.listIterator();
  while (iterator.hasNext()) {
    AttributeInfo ai = (AttributeInfo)iterator.next();
    if (ai.getName().equals(name))
      return ai;
  }
  return null;            // no such attribute
}
origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testEmptyList() throws Exception {
  ArrayList list = new ArrayList(EMPTY_SET);
  assertEquals(0,list.size());
  assertEquals(true,list.isEmpty());
  assertEquals(false,list.contains(1));
  assertEquals(false,list.iterator().hasNext());
  ListIterator it = list.listIterator();
  assertEquals(false, it.hasNext());
  assertEquals(-1, it.previousIndex());
  assertEquals(0, it.nextIndex());
}
@Test
origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testSingleList() throws Exception {
  ArrayList list = new ArrayList(singleton(1));
  assertEquals(1,list.size());
  assertEquals(false,list.isEmpty());
  assertEquals(true,list.contains(1));
  assertEquals(false,list.contains(0));
  assertEquals(true,list.iterator().hasNext());
  assertEquals(1,list.iterator().next());
  ListIterator it = list.listIterator();
  assertEquals(true, it.hasNext());
  assertEquals(-1, it.previousIndex());
  assertEquals(0, it.nextIndex());
  assertEquals(1, it.next());
  assertEquals(0, it.previousIndex());
  assertEquals(1, it.nextIndex());
  assertEquals(true, it.hasPrevious());
  assertEquals(1, it.previous());
  assertEquals(1, it.next());
  assertEquals(false, it.hasNext());
}
origin: EvoSuite/evosuite

  public void testMe(ArrayList<Integer> integerList, int index) {
    ListIterator<Integer> litr = integerList.listIterator(index);
    int element = litr.next();
  }
}
origin: redisson/redisson

static synchronized AttributeInfo remove(ArrayList list, String name) {
  if (list == null)
    return null;
  AttributeInfo removed = null;
  ListIterator iterator = list.listIterator();
  while (iterator.hasNext()) {
    AttributeInfo ai = (AttributeInfo)iterator.next();
    if (ai.getName().equals(name)) {
      iterator.remove();
      removed = ai;
    }
  }
  return removed;
}
origin: neo4j-contrib/neo4j-apoc-procedures

assertEquals(2, it.next());
assertEquals(false, it.hasNext());
ListIterator li = list.listIterator();
assertEquals(true, li.hasNext());
assertEquals(-1, li.previousIndex());
assertEquals(0, li.nextIndex());
assertEquals(1, li.next());
assertEquals(0, li.previousIndex());
assertEquals(1, li.nextIndex());
assertEquals(true, li.hasPrevious());
assertEquals(1, li.previous());
assertEquals(1, li.next());
assertEquals(true, li.hasNext());
assertEquals(0, li.previousIndex());
assertEquals(1, li.nextIndex());
assertEquals(2, li.next());
assertEquals(1, li.previousIndex());
assertEquals(2, li.nextIndex());
assertEquals(true, li.hasPrevious());
assertEquals(false, li.hasNext());
assertEquals(2, li.previous());
origin: hankcs/HanLP

/**
 * 随机挑一个近义词
 * @param type 类型
 * @return
 */
public Synonym randomSynonym(Type type, String preWord)
{
  ArrayList<Synonym> synonymArrayList = new ArrayList<Synonym>(synonymList);
  ListIterator<Synonym> listIterator = synonymArrayList.listIterator();
  if (type != null) while (listIterator.hasNext())
  {
    Synonym synonym = listIterator.next();
    if (synonym.type != type || (preWord != null && CoreBiGramTableDictionary.getBiFrequency(preWord, synonym.realWord) == 0)) listIterator.remove();
  }
  if (synonymArrayList.size() == 0) return null;
  return synonymArrayList.get((int) (System.currentTimeMillis() % (long)synonymArrayList.size()));
}
origin: org.jvnet.hudson.hadoop/hadoop-core

private void toString(ArrayList resources, StringBuffer sb) {
 ListIterator i = resources.listIterator();
 while (i.hasNext()) {
  if (i.nextIndex() != 0) {
   sb.append(", ");
  }
  sb.append(i.next());
 }
}
origin: redisson/redisson

private void testExistingField(String name, String descriptor)
    throws DuplicateMemberException {
  ListIterator it = fields.listIterator(0);
  while (it.hasNext()) {
    FieldInfo minfo = (FieldInfo)it.next();
    if (minfo.getName().equals(name))
      throw new DuplicateMemberException("duplicate field: " + name);
  }
}
origin: net.wetheinter/xapi-core-collect

@Override
public Map<Integer, E> toMap(Map<Integer, E> into) {
 if (into == null) {
  into = newMap();
 }
 ListIterator<E> iter = list.listIterator();
 while (iter.hasNext()) {
  into.put(iter.nextIndex(), iter.next());
 }
 return into;
}
origin: scouter-project/scouter

static AttributeInfo lookup(ArrayList list, String name) {
  if (list == null)
    return null;
  ListIterator iterator = list.listIterator();
  while (iterator.hasNext()) {
    AttributeInfo ai = (AttributeInfo)iterator.next();
    if (ai.getName().equals(name))
      return ai;
  }
  return null;            // no such attribute
}
origin: scouter-project/scouter

static synchronized AttributeInfo remove(ArrayList list, String name) {
  if (list == null)
    return null;
  AttributeInfo removed = null;
  ListIterator iterator = list.listIterator();
  while (iterator.hasNext()) {
    AttributeInfo ai = (AttributeInfo)iterator.next();
    if (ai.getName().equals(name)) {
      iterator.remove();
      removed = ai;
    }
  }
  return removed;
}
origin: org.freemarker/freemarker

@Override
protected Expression deepCloneWithIdentifierReplaced_inner(
    String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
  ArrayList clonedValues = (ArrayList) items.clone();
  for (ListIterator iter = clonedValues.listIterator(); iter.hasNext(); ) {
    iter.set(((Expression) iter.next()).deepCloneWithIdentifierReplaced(
        replacedIdentifier, replacement, replacementState));
  }
  return new ListLiteral(clonedValues);
}
origin: Sable/soot

public boolean add(Object toadd) {
 if (contains(toadd)) {
  return false;
 }
 /* it is not added to the end, but keep it in the order */
 int index = fulllist.indexOf(toadd);
 for (ListIterator worklistIter = worklist.listIterator(); worklistIter.hasNext();) {
  Object tocomp = worklistIter.next();
  int tmpidx = fulllist.indexOf(tocomp);
  if (index < tmpidx) {
   worklistIter.add(toadd);
   return true;
  }
 }
 return false;
}
origin: commons-collections/commons-collections

  ListIterator li1 = list.listIterator();
  ListIterator li2 = lo.listIterator();
  while (li1.hasNext() && li2.hasNext()) {
    Object o1 = li1.next();
    Object o2 = li2.next();
    if (!(o1 == null ? o2 == null : o1.equals(o2)))
      return (false);
  return (!(li1.hasNext() || li2.hasNext()));
} else {
  synchronized (list) {
    ListIterator li1 = list.listIterator();
    ListIterator li2 = lo.listIterator();
    while (li1.hasNext() && li2.hasNext()) {
      Object o1 = li1.next();
      Object o2 = li2.next();
      if (!(o1 == null ? o2 == null : o1.equals(o2)))
origin: scouter-project/scouter

private void testExistingField(String name, String descriptor)
    throws DuplicateMemberException {
  ListIterator it = fields.listIterator(0);
  while (it.hasNext()) {
    FieldInfo minfo = (FieldInfo)it.next();
    if (minfo.getName().equals(name))
      throw new DuplicateMemberException("duplicate field: " + name);
  }
}
origin: org.freemarker/freemarker

@Override
protected Expression deepCloneWithIdentifierReplaced_inner(
    String replacedIdentifier, Expression replacement, ReplacemenetState replacementState) {
  ArrayList clonedKeys = (ArrayList) keys.clone();
  for (ListIterator iter = clonedKeys.listIterator(); iter.hasNext(); ) {
    iter.set(((Expression) iter.next()).deepCloneWithIdentifierReplaced(
        replacedIdentifier, replacement, replacementState));
  }
  ArrayList clonedValues = (ArrayList) values.clone();
  for (ListIterator iter = clonedValues.listIterator(); iter.hasNext(); ) {
    iter.set(((Expression) iter.next()).deepCloneWithIdentifierReplaced(
        replacedIdentifier, replacement, replacementState));
  }
  return new HashLiteral(clonedKeys, clonedValues);
}
origin: immutables/immutables

static List<Term> trimLeadingIndent(List<Term> code) {
 ArrayList<Term> result = new ArrayList<>(code);
 ListIterator<Term> it = result.listIterator();
 while (it.hasNext()) {
  Term t = it.next();
  if (t.isWhitespace()) {
   String whitespace = t.toString();
   int indexOf = whitespace.indexOf('\n');
   if (indexOf >= 0) {
    it.set(new Whitespace(whitespace.substring(0, indexOf + 1)));
   }
  }
 }
 return result;
}
origin: wildfly/wildfly

  ListIterator li1 = list.listIterator();
  ListIterator li2 = lo.listIterator();
  while (li1.hasNext() && li2.hasNext()) {
    Object o1 = li1.next();
    Object o2 = li2.next();
    if (!(o1 == null ? o2 == null : o1.equals(o2)))
      return (false);
  return (!(li1.hasNext() || li2.hasNext()));
} else {
  synchronized (list) {
    ListIterator li1 = list.listIterator();
    ListIterator li2 = lo.listIterator();
    while (li1.hasNext() && li2.hasNext()) {
      Object o1 = li1.next();
      Object o2 = li2.next();
      if (!(o1 == null ? o2 == null : o1.equals(o2)))
origin: apache/incubator-druid

public double cost(DataSegment segment)
{
 double cost = 0.0;
 int index = Collections.binarySearch(intervals, segment.getInterval(), Comparators.intervalsByStartThenEnd());
 index = (index >= 0) ? index : -index - 1;
 for (ListIterator<Bucket> it = sortedBuckets.listIterator(index); it.hasNext(); ) {
  Bucket bucket = it.next();
  if (!bucket.inCalculationInterval(segment)) {
   break;
  }
  cost += bucket.cost(segment);
 }
 for (ListIterator<Bucket> it = sortedBuckets.listIterator(index); it.hasPrevious(); ) {
  Bucket bucket = it.previous();
  if (!bucket.inCalculationInterval(segment)) {
   break;
  }
  cost += bucket.cost(segment);
 }
 return cost;
}
java.utilArrayListlistIterator

Javadoc

Returns a list iterator over the elements in this list (in proper sequence).

The returned list 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.
  • iterator
    Returns an iterator over the elements in this list in proper sequence.The returned iterator is fail-
  • contains
    Searches this ArrayList for the specified object.
  • set
    Replaces the element at the specified position in this list with the specified element.
  • contains,
  • 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 Sublime Text 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