APISonar


java.util.ArrayList.listIterator

> java > util > ArrayList > listIterator
java APIs util APIs ArrayList APIs listIterator APIs

Example 1
public void testListIteratorCreateInvalid() {
    ArrayList l = new ArrayList();
    l.add(new Integer(1));
    l.listIterator(0);
    try {
      l.listIterator(1);
    } catch (IndexOutOfBoundsException e) {
      // expected
    }
    try {
      l.listIterator(-1);
    } catch (IndexOutOfBoundsException e) {
      // expected
    }
  }
Example 2
private ArrayList myArrayList;

	public ListIterator<Object> listIterator() {
		// TODO Auto-generated method stub
		return myArrayList.listIterator();
	}
Example 3
protected ArrayList list = null;

    public ListIterator listIterator() {
        if (fast) {
            return new ListIter(0);
        } else {
            return list.listIterator();
        }
    }
Example 4
private ArrayList<Future<?>> runnables = new ArrayList<Future<?>>();

    public synchronized ListIterator<Future<?>> listIterator(int index) {
        enabled = false;
        return runnables.listIterator(index);
    }
Example 5
private ArrayList<Object> resources = new ArrayList<Object>();

  private void toString(List resources, StringBuffer sb) {
    ListIterator i = resources.listIterator();
    while (i.hasNext()) {
      if (i.nextIndex() != 0) {
        sb.append(", ");
      }
      sb.append(i.next());
    }
  }
Example 6
public void testListIteratorSetInSeveralPositions() {
    ArrayList l = new ArrayList();
    for (int n = 0; n < 5; n += 2) {
      l.add(new Integer(n));
    }
    l.listIterator();
    for (int n = 0; n < 3; n++) {
      l.set(n, new Integer(n));
    }
    for (int n = 0; n < 3; n++) {
      assertEquals(new Integer(n), l.get(n));
    }
  }
Example 7
void remove_all_copies(ArrayList<TestField> s, String fieldName)
    {
        ListIterator<TestField> it = s.listIterator();
        while (it.hasNext()) {
            TestField field = it.next();
            if (field._fieldName.equals(fieldName)) {
                it.remove();
            }
        }
    }
Example 8
private final ArrayList<BlockOutputStreamEntry> streamEntries;

  private void removeEmptyBlocks() {
    if (currentStreamIndex < streamEntries.size()) {
      ListIterator<BlockOutputStreamEntry> streamEntryIterator =
          streamEntries.listIterator(currentStreamIndex);
      while (streamEntryIterator.hasNext()) {
        if (streamEntryIterator.next().getCurrentPosition() == 0) {
          streamEntryIterator.remove();
        }
      }
    }
  }
Example 9
private ArrayList<String> tokenList = new ArrayList<String>();

  private void writePayload(LengthConstrainedArray stream) {
    ListIterator<String> tokenIterator = tokenList.listIterator(tokenList.size());
    while (tokenIterator.hasPrevious()) {
      stream.addToken(tokenIterator.previous());
    }
  }
Example 10
private ArrayList _attached = new ArrayList();

    public void detachEventDispatcher(EventDispatcher ev) {
        if (ev == null) return;
        synchronized (_attached) {
            ListIterator it = _attached.listIterator();
            while (it.hasNext()) {
                if (((EventDispatcher) it.next()) == ev) {
                    it.remove();
                    break;
                }
            }
        }
    }
Example 11
public OffsetBuild<T> getNextBuildToFetch(final Iterable<T> builds, final HistoryWidget.Adapter<? super T> adapter) {
        final ArrayList<T> list = Lists.newArrayList(builds);
        if (!list.isEmpty()) {
            final ListIterator<T> listIterator = list.listIterator(list.size());

            while (listIterator.hasPrevious()) {
                final T record = listIterator.previous();
                if (adapter.isBuilding(record))
                    return new OffsetBuild<>(record, 0);
            }

            return new OffsetBuild(list.get(0), 1);
        }
        return new OffsetBuild<>(null, 0);
    }
Example 12
protected ArrayList<AbstractDataType> objectList = new ArrayList<AbstractDataType>();

    public final void setObjectValue(String identifier, Object value)
    {
        AbstractDataType object;
        Iterator<AbstractDataType> iterator = objectList.listIterator();
        while (iterator.hasNext())
        {
            object = iterator.next();
            if (object.getIdentifier().equals(identifier))
            {
                object.setValue(value);
            }
        }
    }
Example 13
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);
    }
Example 14
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;
  }
Example 15
public Iterator<T> iterator() {
    ArrayList<T> cache = new ArrayList<T>();
    for (T u : getInput()) {
      cache.add(u);
    }
    return new ReversingSequence.ReversingIterator(cache.listIterator(cache.size()));
  }
Example 16
private static DefaultResourceResolverChain initChain(ArrayList<? extends ResourceResolver> resolvers) {
		DefaultResourceResolverChain chain = new DefaultResourceResolverChain(null, null);
		ListIterator<? extends ResourceResolver> it = resolvers.listIterator(resolvers.size());
		while (it.hasPrevious()) {
			chain = new DefaultResourceResolverChain(it.previous(), chain);
		}
		return chain;
	}
Example 17
SQLServerTokenIterator(ArrayList<? extends Token> tokenList) {
        this.iter = tokenList.listIterator();
        this.index = new AtomicInteger(0);
        this.listSize = tokenList.size();
    }
Example 18
private DefaultResourceTransformerChain initTransformerChain(ResourceResolverChain resolverChain,
			ArrayList<ResourceTransformer> transformers) {

		DefaultResourceTransformerChain chain = new DefaultResourceTransformerChain(resolverChain, null, null);
		ListIterator<? extends ResourceTransformer> it = transformers.listIterator(transformers.size());
		while (it.hasPrevious()) {
			chain = new DefaultResourceTransformerChain(resolverChain, it.previous(), chain);
		}
		return chain;
	}