当前位置: 首页>>代码示例>>Java>>正文


Java ListIterator.nextIndex方法代码示例

本文整理汇总了Java中java.util.ListIterator.nextIndex方法的典型用法代码示例。如果您正苦于以下问题:Java ListIterator.nextIndex方法的具体用法?Java ListIterator.nextIndex怎么用?Java ListIterator.nextIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ListIterator的用法示例。


在下文中一共展示了ListIterator.nextIndex方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contains

import java.util.ListIterator; //导入方法依赖的package包/类
@Override
public boolean contains(@Nullable Object o) {
  if (!(o instanceof List)) {
    return false;
  }
  List<?> list = (List<?>) o;
  if (list.size() != axes.size()) {
    return false;
  }
  ListIterator<?> itr = list.listIterator();
  while (itr.hasNext()) {
    int index = itr.nextIndex();
    if (!axes.get(index).contains(itr.next())) {
      return false;
    }
  }
  return true;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:19,代码来源:CartesianList.java

示例2: removeMultiplePeaks

import java.util.ListIterator; //导入方法依赖的package包/类
public PeakList removeMultiplePeaks() {
    // TODO (LS) :
    ListIterator<Peak> peakListIterator = this.pList.listIterator();

    while (peakListIterator.hasNext()) {
        int index = peakListIterator.nextIndex();
        Peak currentPeak = peakListIterator.next();
        for (int j = 0; j < index; ++j) {
            if (currentPeak.equalsPeak(this.pList.get(j))) {
                peakListIterator.remove();
                break; // TODO why break ?
            }
        }
    }

    return this;
}
 
开发者ID:protViz,项目名称:deisotoper,代码行数:18,代码来源:PeakList.java

示例3: lastIndexOfKey

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public int lastIndexOfKey(K key)
{
  ListIterator<Map.Entry<K,V>> i = entryListIterator(size());
  if (key == null)
  {
    while (i.hasPrevious())
    {
      if (i.previous() == null) return i.nextIndex();
    }
  }
  else
  {
    while (i.hasPrevious())
    {
      if (key.equals(i.previous())) return i.nextIndex();
    }
  }
  return -1;
}
 
开发者ID:cinnober,项目名称:ciguan,代码行数:23,代码来源:AbstractIndexedMap.java

示例4: threadSafeRemove

import java.util.ListIterator; //导入方法依赖的package包/类
public synchronized void threadSafeRemove(@NonNull final IThreadSafeConditions<T> conditions) {

        if (conditions == null) {
            throw new IllegalArgumentException("conditions cannot be null");
        }

        /*
         * Remove everything except PivotsRV
         *
         * Use iterator to avoid ConcurrentModificationException
         */
        ListIterator<T> iterator = getList().listIterator();
        final Stack<Integer> positions = new Stack<>();
        int position;
        T item;
        while (iterator.hasNext()) {
            position = iterator.nextIndex();
            item = iterator.next();
            if (conditions.removeIf(item)) {
                iterator.remove();
                positions.push(position);
            }
        }
        conditions.onItemsRemoved(positions);
    }
 
开发者ID:Tenor-Inc,项目名称:tenor-android-core,代码行数:26,代码来源:ListRVAdapter.java

示例5: generate

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Generate separate index files, for each Unicode character, listing all
 * the members starting with the particular unicode character.
 *
 * @param configuration the configuration for this doclet
 * @param indexbuilder IndexBuilder built by {@link IndexBuilder}
 * @throws DocFileIOException if there is a problem generating the index files
 */
public static void generate(HtmlConfiguration configuration,
                            IndexBuilder indexbuilder) throws DocFileIOException {
    DocPath path = DocPaths.INDEX_FILES;
    Set<Character> keys = new TreeSet<>(indexbuilder.getIndexMap().keySet());
    keys.addAll(configuration.tagSearchIndexKeys);
    ListIterator<Character> li = new ArrayList<>(keys).listIterator();
    int prev;
    int next;
    while (li.hasNext()) {
        prev = (li.hasPrevious()) ? li.previousIndex() + 1 : -1;
        Object ch = li.next();
        next = (li.hasNext()) ? li.nextIndex() + 1 : -1;
        DocPath filename = DocPaths.indexN(li.nextIndex());
        SplitIndexWriter indexgen = new SplitIndexWriter(configuration,
                path.resolve(filename),
                indexbuilder, keys, prev, next);
        indexgen.generateIndexFile((Character) ch);
        if (!li.hasNext()) {
            indexgen.createSearchIndexFiles();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:SplitIndexWriter.java

示例6: lastIndexOfImpl

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * An implementation of {@link List#lastIndexOf(Object)}.
 */
static int lastIndexOfImpl(List<?> list, @Nullable Object element) {
  ListIterator<?> listIterator = list.listIterator(list.size());
  while (listIterator.hasPrevious()) {
    if (Objects.equal(element, listIterator.previous())) {
      return listIterator.nextIndex();
    }
  }
  return -1;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:13,代码来源:Lists.java

示例7: toString

import java.util.ListIterator; //导入方法依赖的package包/类
private <T> void toString(List<T> resources, StringBuilder sb) {
  ListIterator<T> i = resources.listIterator();
  while (i.hasNext()) {
    if (i.nextIndex() != 0) {
      sb.append(", ");
    }
    sb.append(i.next());
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:10,代码来源:Configuration.java

示例8: lastIndexOfImpl

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * An implementation of {@link List#lastIndexOf(Object)}.
 */
static int lastIndexOfImpl(List<?> list, @Nullable Object element) {
  if (list instanceof RandomAccess) {
    return lastIndexOfRandomAccess(list, element);
  } else {
    ListIterator<?> listIterator = list.listIterator(list.size());
    while (listIterator.hasPrevious()) {
      if (Objects.equal(element, listIterator.previous())) {
        return listIterator.nextIndex();
      }
    }
    return -1;
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:Lists.java

示例9: _scanQueue

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Run through the queue to see if we got a possible match of:
 * [0] stx, [1 - (n-1)] Integers within time frame, [n]
 * @return the count of key events we can dump out to the user
 */
private int _scanQueue()
{
    StringBuilder barcode = new StringBuilder();
    ListIterator<KeyEvent> iter = queue.listIterator();

    KeyEvent first = iter.next();
    if ((first.getID() != KeyEvent.KEY_TYPED) || (first.getKeyChar() != config.stx))
        return 1;
    
    while (iter.hasNext())
    {
        KeyEvent ke = iter.next();            
        if (ke.getID() != KeyEvent.KEY_TYPED)  // only look at TYPED events
            continue;

        Character c = ke.getKeyChar();
        if (c == config.stx) // a second stx char, clear buffer before this 
            return iter.nextIndex()-1;
        
        if (c == config.etx) {
            queue.clear();
            log.log(Level.FINE, "Scanned barcode {0}", barcode);
            Messenger.sendEvent(MT.BARCODE_SCANNED, barcode.toString());
            return iter.nextIndex();  // time to dump
        }

        barcode.append(c);            
        if (barcode.length() > 20) {
            log.log(Level.FINE, "Barcode too long, ignoring");
            return iter.nextIndex(); // time to dump
        }
    }

    return 0;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:41,代码来源:BarcodeScannerWatcher.java

示例10: toString

import java.util.ListIterator; //导入方法依赖的package包/类
private void toString(List resources, StringBuffer sb) {
  ListIterator i = resources.listIterator();
  while (i.hasNext()) {
    if (i.nextIndex() != 0) {
      sb.append(", ");
    }
    sb.append(i.next());
  }
}
 
开发者ID:spafka,项目名称:spark_deep,代码行数:10,代码来源:Configuration.java

示例11: nextIndex

import java.util.ListIterator; //导入方法依赖的package包/类
/**
 * Returns the index of the next element.
 *
 * @return the index of the next element
 */
public int nextIndex() {
    if (iterator instanceof ListIterator) {
        final ListIterator<?> li = (ListIterator<?>) iterator;
        return li.nextIndex();
    }
    return currentIndex;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:13,代码来源:ListIteratorWrapper.java

示例12: decodeMap

import java.util.ListIterator; //导入方法依赖的package包/类
private Map<Executable, State> decodeMap(List<String> lines) {
    if (lines == null || lines.size() == 0) {
        throw new Error("TESTBUG: unexpected lines list");
    }
    Map<Executable, State> stateMap = new HashMap<>();
    int startIndex = 0;
    ListIterator<String> iterator = lines.listIterator();
    while (iterator.hasNext()) {
        int index = iterator.nextIndex();
        String next = iterator.next();
        switch (next) {
            case "{" :
                startIndex = index;
                break;
            case "}" :
                // method name goes after {
                Executable executable = METHODS_NAMES.get(lines.get(
                        ++startIndex));
                // state description starts after method
                State state = State.fromString(lines.subList(++startIndex,
                        index).toArray(new String[index - startIndex]));
                stateMap.put(executable, state);
                break;
        }
    }
    return stateMap;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:BaseAction.java


注:本文中的java.util.ListIterator.nextIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。