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


Java Iterator.next方法代码示例

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


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

示例1: getScanCount_2

import java.util.Iterator; //导入方法依赖的package包/类
private int getScanCount_2(MTable table, String locatorPort) {
    Scanner scanner = table.getScanner(new Scan());
    Iterator itr = scanner.iterator();
    int totalCount = 0;
    while (itr.hasNext()) {
      Row result = (Row) itr.next();

      List<Cell> selectedRow = result.getCells();

//      for (Cell cell : selectedRow) {
//        System.out.print("  [ColumnName: " + Bytes.toString(cell.getColumnName()) + " ColumnValue:"
//            + cell.getColumnValue() + "], ");
//
//      }
      totalCount++;
    }
//    System.out.println();
    return totalCount;
  }
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:AmpoolSinkTaskTest.java

示例2: obtenerTablaComportamientosDefinidosRecursos

import java.util.Iterator; //导入方法依赖的package包/类
public void obtenerTablaComportamientosDefinidosRecursos()
	throws ExcepcionEnComponente {
                      DescRecursoAplicacion desc;
          Iterator<DescRecursoAplicacion> iter = this.descOrganizacion.getDescripcionComponentes()
                                                     .getDescRecursosAplicacion().getDescRecursoAplicacion().iterator();
while (iter.hasNext()) {
	desc = iter.next();
                      String identComportamiento = desc.getNombre();
                      // verificamos que el comportamiento no esta repetido
                      if (tablaComportamientosDefinidos.containsKey(identComportamiento) ){
                          throw new ExcepcionEnComponente(
		"El comportamiento de nombre "
				+ identComportamiento
				+ " esta duplicado : Comprobar la descripcion de la organizacion");
                          } else
                              tablaComportamientosDefinidos.put(identComportamiento, desc);
                  }
       }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:19,代码来源:ConstructorDescOrganizacion.java

示例3: getStatsRowKeyIterator

import java.util.Iterator; //导入方法依赖的package包/类
@Override
protected Iterator<Object> getStatsRowKeyIterator(boolean interval) {
    final Iterator<Procedure> it = this.procStats.keySet().iterator();
    return new Iterator<Object>() {
        @Override
        public boolean hasNext() {
            return it.hasNext();
        }
        @Override
        public Object next() {
            return it.next();
        }
        @Override
        public void remove() {
            it.remove();
        }
    };
}
 
开发者ID:s-store,项目名称:s-store,代码行数:19,代码来源:TransactionProfilerStats.java

示例4: retainOccurrencesImpl

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Delegate implementation which cares about the element type.
 */
private static <E> boolean retainOccurrencesImpl(
    Multiset<E> multisetToModify, Multiset<?> occurrencesToRetain) {
  checkNotNull(multisetToModify);
  checkNotNull(occurrencesToRetain);
  // Avoiding ConcurrentModificationExceptions is tricky.
  Iterator<Entry<E>> entryIterator = multisetToModify.entrySet().iterator();
  boolean changed = false;
  while (entryIterator.hasNext()) {
    Entry<E> entry = entryIterator.next();
    int retainCount = occurrencesToRetain.count(entry.getElement());
    if (retainCount == 0) {
      entryIterator.remove();
      changed = true;
    } else if (retainCount < entry.getCount()) {
      multisetToModify.setCount(entry.getElement(), retainCount);
      changed = true;
    }
  }
  return changed;
}
 
开发者ID:s-store,项目名称:s-store,代码行数:24,代码来源:Multisets.java

示例5: equals

import java.util.Iterator; //导入方法依赖的package包/类
@Override
public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof MultiTransactionRecord)) return false;

    MultiTransactionRecord that = (MultiTransactionRecord) o;

    if (ops != null) {
        Iterator<Op> other = that.ops.iterator();
        for (Op op : ops) {
            boolean hasMoreData = other.hasNext();
            if (!hasMoreData) {
                return false;
            }
            Op otherOp = other.next();
            if (!op.equals(otherOp)) {
                return false;
            }
        }
        return !other.hasNext();
    } else {
        return that.ops == null;
    }

}
 
开发者ID:l294265421,项目名称:ZooKeeper,代码行数:26,代码来源:MultiTransactionRecord.java

示例6: listOutputPorts

import java.util.Iterator; //导入方法依赖的package包/类
public List<MidiOutputPort> listOutputPorts() {
	try {
		this.lock();
		
		List<MidiOutputPort> ports = new ArrayList<MidiOutputPort>();
		Iterator<MidiOutputPortProvider> it = this.outputPortProviders.iterator();
		while(it.hasNext()){
			try{
				MidiOutputPortProvider provider = (MidiOutputPortProvider)it.next();
				ports.addAll(provider.listPorts());
			}catch(Throwable throwable){
				throwable.printStackTrace();
			}
		}
		return ports;
	} finally {
		this.unlock();
	}
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:20,代码来源:MidiPlayer.java

示例7: testDescendingSubSetContents

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * subSet returns set with keys in requested range
 */
public void testDescendingSubSetContents() {
    NavigableSet set = dset5();
    SortedSet sm = set.subSet(m2, m4);
    assertEquals(m2, sm.first());
    assertEquals(m3, sm.last());
    assertEquals(2, sm.size());
    assertFalse(sm.contains(m1));
    assertTrue(sm.contains(m2));
    assertTrue(sm.contains(m3));
    assertFalse(sm.contains(m4));
    assertFalse(sm.contains(m5));
    Iterator i = sm.iterator();
    Object k;
    k = (Integer)(i.next());
    assertEquals(m2, k);
    k = (Integer)(i.next());
    assertEquals(m3, k);
    assertFalse(i.hasNext());
    Iterator j = sm.iterator();
    j.next();
    j.remove();
    assertFalse(set.contains(m2));
    assertEquals(4, set.size());
    assertEquals(1, sm.size());
    assertEquals(m3, sm.first());
    assertEquals(m3, sm.last());
    assertTrue(sm.remove(m3));
    assertTrue(sm.isEmpty());
    assertEquals(3, set.size());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:ConcurrentSkipListSubSetTest.java

示例8: SongIteration

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Iterates through a Song and adds every Part on a new channel of the given track
 * @param song
 * @param track
 * @param counter
 */
private void SongIteration(Song song, Track track, long counter){
	Iterator<Part> partsIterator = song.iterator();
	byte channel = 1;
	while(partsIterator.hasNext()){
		Part part = partsIterator.next();
		eventMaking(counter, track, part, channel);
		channel++;
	}
}
 
开发者ID:Paulpanther,项目名称:Random-Music-Generator,代码行数:16,代码来源:TrackFactory.java

示例9: applyTo

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Applies this check to a set of nodes.
 * @param aNodes the nodes to check.
 */
public void applyTo(Set aNodes)
{
    final Iterator it = aNodes.iterator();
    while (it.hasNext()) {
        final DetailAST nameAST = (DetailAST) it.next();
        if (getReferenceCount(nameAST) == 1) {
            log(
                nameAST.getLineNo(),
                nameAST.getColumnNo(),
                getErrorKey(),
                nameAST.getText());
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:AbstractUsageCheck.java

示例10: nextName

import java.util.Iterator; //导入方法依赖的package包/类
@Override public String nextName() throws IOException {
  expect(JsonToken.NAME);
  Iterator<?> i = (Iterator<?>) peekStack();
  Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
  stack.add(entry.getValue());
  return (String) entry.getKey();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:JsonTreeReader.java

示例11: getEdges

import java.util.Iterator; //导入方法依赖的package包/类
/**
 *
 * @param cell
 * @return
 */
public Object[] getEdges(final Object cell) {
  final mxIGraphModel model = this.graph.getModel();
  final boolean isCollapsed = this.graph.isCellCollapsed(cell);
  final List<Object> edges = new ArrayList<Object>();
  final int childCount = model.getChildCount(cell);

  for (int i = 0; i < childCount; i++) {
    final Object child = model.getChildAt(cell, i);

    if (isCollapsed || !this.graph.isCellVisible(child)) {
      edges.addAll(Arrays.asList(mxGraphModel.getEdges(model, child, true, true, false)));
    }
  }

  edges.addAll(Arrays.asList(mxGraphModel.getEdges(model, cell, true, true, false)));
  final List<Object> result = new ArrayList<Object>(edges.size());
  final Iterator<Object> it = edges.iterator();

  while (it.hasNext()) {
    final Object edge = it.next();
    final mxCellState state = this.graph.getView().getState(edge);
    final Object source = state != null ? state.getVisibleTerminal(true)
        : this.graph.getView().getVisibleTerminal(edge, true);
    final Object target = state != null ? state.getVisibleTerminal(false)
        : this.graph.getView().getVisibleTerminal(edge, false);

    if (source != target && (target == cell
        && (this.parent == null
            || this.graph.isValidAncestor(source, this.parent, this.traverseAncestors))
        || source == cell && (this.parent == null
            || this.graph.isValidAncestor(target, this.parent, this.traverseAncestors)))) {
      result.add(edge);
    }
  }

  return result.toArray();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:43,代码来源:mxHierarchicalLayout.java

示例12: copyOf

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Returns an immutable list containing the given elements, in order.
 *
 * @throws NullPointerException if any of {@code elements} is null
 */
public static <E> ImmutableList<E> copyOf(Iterator<? extends E> elements) {
  // We special-case for 0 or 1 elements, but going further is madness.
  if (!elements.hasNext()) {
    return of();
  }
  E first = elements.next();
  if (!elements.hasNext()) {
    return of(first);
  } else {
    return new ImmutableList.Builder<E>().add(first).addAll(elements).build();
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:18,代码来源:ImmutableList.java

示例13: concat

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Combines multiple iterators into a single iterator. The returned iterator
 * iterates across the elements of each iterator in {@code inputs}. The input
 * iterators are not polled until necessary.
 *
 * <p>The returned iterator supports {@code remove()} when the corresponding
 * input iterator supports it. The methods of the returned iterator may throw
 * {@code NullPointerException} if any of the input iterators is null.
 *
 * <p><b>Note:</b> the current implementation is not suitable for nested
 * concatenated iterators, i.e. the following should be avoided when in a loop:
 * {@code iterator = Iterators.concat(iterator, suffix);}, since iteration over the
 * resulting iterator has a cubic complexity to the depth of the nesting.
 */
public static <T> Iterator<T> concat(
    final Iterator<? extends Iterator<? extends T>> inputs) {
  checkNotNull(inputs);
  return new Iterator<T>() {
    Iterator<? extends T> current = emptyIterator();
    Iterator<? extends T> removeFrom;

    @Override
    public boolean hasNext() {
      // http://code.google.com/p/google-collections/issues/detail?id=151
      // current.hasNext() might be relatively expensive, worth minimizing.
      boolean currentHasNext;
      // checkNotNull eager for GWT
      // note: it must be here & not where 'current' is assigned,
      // because otherwise we'll have called inputs.next() before throwing
      // the first NPE, and the next time around we'll call inputs.next()
      // again, incorrectly moving beyond the error.
      while (!(currentHasNext = checkNotNull(current).hasNext())
          && inputs.hasNext()) {
        current = inputs.next();
      }
      return currentHasNext;
    }
    @Override
    public T next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      removeFrom = current;
      return current.next();
    }
    @Override
    public void remove() {
      checkRemove(removeFrom != null);
      removeFrom.remove();
      removeFrom = null;
    }
  };
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:54,代码来源:Iterators.java

示例14: parseChangeLog

import java.util.Iterator; //导入方法依赖的package包/类
public List parseChangeLog(final File logFile) throws MalformedURLException, DocumentException {
    final List result = new ArrayList(11);
    final SAXReader saxReader = new SAXReader();
    final Document document = saxReader.read(logFile);
    final Element rootElement = document.getRootElement();
//    if (LOG.isDebugEnabled()) {
//      LOG.debug("rootElement: " + rootElement);
//    }
    // Iterate transactions
    int changeListCounter = 0;
    final Iterator iter = rootElement.elementIterator();
    while (iter.hasNext() && changeListCounter++ < maxChangeLists) {
      final Element transactionElement = (Element) iter.next();
      if (!transactionElement.getName().equals("transaction")) {
        continue;
      }
//      if (LOG.isDebugEnabled()) {
//        LOG.debug("transactionElement: " + transactionElement);
//      }
      // Create change list
      final String type = transactionElement.attributeValue("type");
      final byte changeType = toChangeType(type);
      if (changeType == Change.TYPE_UNKNOWN) {
        continue;
      }
      final String id = transactionElement.attributeValue("id");
      final String time = transactionElement.attributeValue("time");
      final String user = transactionElement.attributeValue("user");
      final Element elementComment = transactionElement.element("comment");
      final String comment = elementComment.getText();
      final ChangeList changeList = new ChangeList();
      changeList.setCreatedAt(new Date(Long.parseLong(time) * 1000L));
      changeList.setDescription(comment);
      changeList.setNumber(id);
      changeList.setUser(user);
      // Iterate versions
      int changeCounter = 0;
      final Set changes = new HashSet(11);
      final Iterator versionIter = transactionElement.elementIterator("version");
      while (versionIter.hasNext() && changeCounter++ < maxChangeListSize) {
        final Element versionElement = (Element) versionIter.next();
        final String path = versionElement.attributeValue("path");
        final String version = versionElement.attributeValue("virtualNamedVersion");
        final Change change = new Change(path, version, changeType);
        changes.add(change);
      }
      changeList.setChanges(changes);
      // Add to result
      result.add(changeList);
    }
    return result;
  }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:53,代码来源:AccurevChangeLogParser.java

示例15: getMimeHeaders

import java.util.Iterator; //导入方法依赖的package包/类
@Override
public Iterator<MimeHeader> getMimeHeaders() {
    final Iterator<? extends Header> ih = part.getAllHeaders()
            .iterator();
    return new Iterator<MimeHeader>() {
        @Override
        public boolean hasNext() {
            return ih.hasNext();
        }

        @Override
        public MimeHeader next() {
            final Header hdr = ih.next();
            return new AttachmentEx.MimeHeader() {
                @Override
                public String getValue() {
                    return hdr.getValue();
                }
                @Override
                public String getName() {
                    return hdr.getName();
                }
            };
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:MimeMultipartParser.java


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