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


Java Iterator.hasNext方法代码示例

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


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

示例1: getNextRenderedChildIndex

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * @param afterChildIndex The children coming after this index, will
 * be considered.
 * @return the index of the next child that must be rendered, or
 * {@link #NO_CHILD_INDEX} if there is none.
 */
public static int getNextRenderedChildIndex(
  List<UIComponent> components,
  int               afterChildIndex
  )
{
  int childIndex = afterChildIndex + 1;
  Iterator<UIComponent> iter = components.listIterator(childIndex);
  for(; iter.hasNext(); childIndex++)
  {
    if(iter.next().isRendered())
    {
      return childIndex;
    }
  }

  return NO_CHILD_INDEX;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:24,代码来源:CoreRenderer.java

示例2: validateConfiguration

import java.util.Iterator; //导入方法依赖的package包/类
private void validateConfiguration() {
  Iterator<String> it = agentConfigMap.keySet().iterator();

  while (it.hasNext()) {
    String agentName = it.next();
    AgentConfiguration aconf = agentConfigMap.get(agentName);

    if (!aconf.isValid()) {
      logger.warn("Agent configuration invalid for agent '" + agentName
          + "'. It will be removed.");
      errors.add(new FlumeConfigurationError(agentName, "",
          FlumeConfigurationErrorType.AGENT_CONFIGURATION_INVALID,
          ErrorOrWarning.ERROR));

      it.remove();
    }
    logger.debug("Channels:" + aconf.channels + "\n");
    logger.debug("Sinks " + aconf.sinks + "\n");
    logger.debug("Sources " + aconf.sources + "\n");
  }

  logger.info("Post-validation flume configuration contains configuration"
      + " for agents: " + agentConfigMap.keySet());
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:25,代码来源:FlumeConfiguration.java

示例3: addMapping

import java.util.Iterator; //导入方法依赖的package包/类
private void addMapping(CaseAnnotationQuery taq, QuestOWLReasonerExt reasoner) 
		throws OWLException, OBDAException, MalformedQueryException{

	//TODO: make a check if reformulateSPARQL2 ada masalah, lanjut ke query berikutnya, jangan mati
	List<SQLWithVarMap> unfoldedQuery = reasoner.reformulateSPARQL2(taq.getQuery());
	Iterator<SQLWithVarMap> it = unfoldedQuery.iterator(); 
	
	while(it.hasNext()){

		SQLWithVarMap sqlWithVarMap = it.next();
		HashMap<String, String> varMap = sqlWithVarMap.getVariableMap();
		
		//TODO: need to check whether taq.getTraceAnsVariable() is null or not before calling varMap.get
		//TODO: need to check whether taq.getNameAnsVariable() is null or not before calling varMap.get
		addTraceNameMapping(sqlWithVarMap.getSQL(), 
					cleanURI(varMap.get(taq.getTraceAnsVariable())),
					cleanURI(varMap.get(taq.getNameAnsVariable()))
			);
	}
}
 
开发者ID:onprom,项目名称:onprom,代码行数:21,代码来源:EBDAModelWithOptimizedXAttributesEncodingImpl.java

示例4: main

import java.util.Iterator; //导入方法依赖的package包/类
public static void main(String[] args) {
  //create an array of type Object, in this case we will create String array
  String[] strArray = new String[]{"Object", "Array", "Converted", "To", "List"};

  /*
    To create List from an array of type Object use,
    static List asList(Object[] objArray) method of Arrays class.

    This method returns a fixed sized list backed by original array.
  */

  List list = Arrays.asList(strArray);

  //get an iterator
  Iterator itr = list.iterator();

  //iterate through list created from Array
  System.out.println("List created from an Array of type Object contains,");
  while (itr.hasNext()) System.out.println(itr.next());
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:CreateListFromObjectArrayExample.java

示例5: enforceAddedRule

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * enforce new added rule
 */
private void enforceAddedRule(ACLRule rule) {

	Set<String> dpidSet;
	if (rule.getNw_src() != null) {
		dpidSet = apManager.getDpidSet(rule.getNw_src_prefix(),rule.getNw_src_maskbits());
	} else {
		dpidSet = apManager.getDpidSet(rule.getNw_dst_prefix(),rule.getNw_dst_maskbits());
	}

	Iterator<String> dpidIter = dpidSet.iterator();
	Set<String> nameSet = new HashSet<String>();

	while (dpidIter.hasNext()) {
		String dpid = dpidIter.next();
		String flowName = "ACLRule_" + rule.getId() + "_" + dpid;
		generateFlow(rule, dpid, flowName);
		nameSet.add(flowName);
	}
	ruleId2FlowName.put(rule.getId(), nameSet);
	ruleId2Dpid.put(rule.getId(), dpidSet);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:25,代码来源:ACL.java

示例6: unionEmail

import java.util.Iterator; //导入方法依赖的package包/类
private Set unionEmail(Set excluded, String email)
{
    if (excluded.isEmpty())
    {
        if (email == null)
        {
            return excluded;
        }
        excluded.add(email);
        return excluded;
    }
    else
    {
        Set union = new HashSet();

        Iterator it = excluded.iterator();
        while (it.hasNext())
        {
            String _excluded = (String)it.next();

            unionEmail(_excluded, email, union);
        }

        return union;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:PKIXNameConstraintValidator.java

示例7: fireValueSourceChanged

import java.util.Iterator; //导入方法依赖的package包/类
private void fireValueSourceChanged(ValueSourceChangeEvent e) {
	Iterator<WeakReference<ValueSourceListener>> it = listeners.iterator();
	while (it.hasNext()) {
		ValueSourceListener l = it.next().get();
		if (l != null) {
			l.valueSourceChanged(e);
		} else {
			it.remove();
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:ValueSource.java

示例8: activateRollingFileAppender

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Changes the initial ConsoleAppender to a RollingFileAppender using the
 * current configuration settings.
 * 
 * @param logFilePath
 *            The path to the log files.
 * @param logConfigFile
 *            The path to the log4j configuration file.
 * @param logLevel
 *            The log level to be used.
 */
public static void activateRollingFileAppender(String logFilePath,
        String logConfigFile, String logLevel) {
    synchronized (managedLoggers) {
        try {
            LoggerFactory.logLevel = logLevel;
            LoggerFactory.logFilePath = logFilePath;
            LoggerFactory.logConfigPath = logConfigFile;

            initAppenders();

            Iterator<Class<?>> iterator = managedLoggers.keySet()
                    .iterator();
            while (iterator.hasNext()) {
                Class<?> loggerName = iterator.next();
                Log4jLogger logger = managedLoggers.get(loggerName);

                // initialize the loggers
                setFileAppendersForLogger(logger);

            }
            switchedToFileAppender = true;
        } catch (IOException e) {
            System.err.println("Log file could not be created!");
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:38,代码来源:LoggerFactory.java

示例9: search

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * E.g. http://api.worldweatheronline.com/free/v2/search.ashx?query=oporto&format=tab&key=*****
 */

public Iterable<Location> search(String query) {
    String url=WEATHER_HOST + WEATHER_SEARCH + WEATHER_SEARCH_ARGS;
    url = String.format(url, query, WEATHER_TOKEN);
    List<Location> locations= new ArrayList<>();
    Iterator<String> iteratorString= req.getContent(url).iterator();
    while(iteratorString.hasNext()) {
        String line = iteratorString.next();
        if(!line.startsWith("#")) locations.add(Location.valueOf(line));
    }
    return locations;
}
 
开发者ID:isel-leic-mpd,项目名称:mpd-2017-i41d,代码行数:16,代码来源:WeatherWebApi.java

示例10: addInterfaces

import java.util.Iterator; //导入方法依赖的package包/类
final void addInterfaces(List<InterfaceType> list) {
    List<InterfaceType> immediate = interfaces();
    list.addAll(interfaces());
    Iterator<InterfaceType> iter = immediate.iterator();
    while (iter.hasNext()) {
        InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
        interfaze.addInterfaces(list);
    }
    ClassTypeImpl superclass = (ClassTypeImpl) superclass();
    if (superclass != null) {
        superclass.addInterfaces(list);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:InvokableTypeImpl.java

示例11: test2DGridScanNoImage

import java.util.Iterator; //导入方法依赖的package包/类
@Test
public void test2DGridScanNoImage() throws Exception {
	detector.getModel().setSaveImage(false);
	try {

		IRunnableDevice<ScanModel> scanner = createGridScan(detector, output, false, new int[]{8,5}); // Outer scan of another scannable, for instance temp.
		assertScanNotFinished(getNexusRoot(scanner).getEntry());
		scanner.run(null);

		NXroot rootNode = getNexusRoot(scanner);
		NXentry entry = rootNode.getEntry();
		Map<String, NXdata> nxDataGroups = entry.getChildren(NXdata.class);

		boolean found = false;

		Iterator<NXdata> it = nxDataGroups.values().iterator();
		//check no NXdata of rank 4
		while (it.hasNext()) {

			NXdata next = it.next();
			String signal = next.getAttributeSignal();
			if (next.getDataNode(signal).getDataset().getRank()==4) {
				found = true;
				break;
			}

		}
		assertFalse(found);

	} finally {
		detector.getModel().setSaveImage(true);
	}

}
 
开发者ID:eclipse,项目名称:scanning,代码行数:35,代码来源:MandelbrotExampleTest.java

示例12: notifyListeners

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * 通知所有注册事件监听的对象
 * 
 * @param i_Event
 */
private void notifyListeners(TimeChangeEvent i_Event)
{
	Iterator<TimeChangeListener> v_Iter = this.listeners.iterator();

	while ( v_Iter.hasNext() ) 
	{
		TimeChangeListener v_Listener = v_Iter.next();

		v_Listener.onChangeListener(i_Event);
	}
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.ui,代码行数:17,代码来源:JTimePanel.java

示例13: removeForUnpublishedArticles

import java.util.Iterator; //导入方法依赖的package包/类
/**
 * Removes archive dates of unpublished articles from the specified archive
 * dates.
 *
 * @param archiveDates
 *            the specified archive dates
 * @throws RepositoryException
 *             repository exception
 */
private void removeForUnpublishedArticles(final List<JSONObject> archiveDates) throws RepositoryException {
	final Iterator<JSONObject> iterator = archiveDates.iterator();

	while (iterator.hasNext()) {
		final JSONObject archiveDate = iterator.next();

		if (0 == archiveDate.optInt(ArchiveDate.ARCHIVE_DATE_PUBLISHED_ARTICLE_COUNT)) {
			iterator.remove();
		}
	}
}
 
开发者ID:daima,项目名称:solo-spring,代码行数:21,代码来源:ArchiveDateDao.java

示例14: notifyObservers

import java.util.Iterator; //导入方法依赖的package包/类
public void notifyObservers() {
    Iterator<WeakReference<BaseViewHolder>> iterator = observers.iterator();
    while (iterator.hasNext()) {
        BaseViewHolder viewHolder = iterator.next().get();
        if (viewHolder != null) {
            if (viewHolder.getAdapterPosition() != RecyclerView.NO_POSITION) {
                viewHolder.notifyChanged();
                return;
            }
        }
        iterator.remove();
    }
}
 
开发者ID:Maxr1998,项目名称:home-assistant-Android,代码行数:14,代码来源:Entity.java

示例15: createCVPDFPainter

import java.util.Iterator; //导入方法依赖的package包/类
public static CVPDFPainter createCVPDFPainter(Collection<StaffOutVO> staffVOs, StaffDao staffDao, CvSectionDao cvSectionDao, CvPositionDao cvPositionDao,
		CourseParticipationStatusEntryDao courseParticipationDao, StaffAddressDao staffAddressDao) throws Exception {
	CVPDFPainter painter = new CVPDFPainter();
	Collection allCvSections = cvSectionDao.loadAllSorted(0, 0);
	cvSectionDao.toCvSectionVOCollection(allCvSections);
	if (staffVOs != null) {
		ArrayList<StaffOutVO> personVOs = new ArrayList<StaffOutVO>(staffVOs.size());
		HashMap<Long, StaffAddressOutVO> addressVOMap = new HashMap<Long, StaffAddressOutVO>(staffVOs.size());
		HashMap<Long, StaffImageOutVO> imageVOMap = new HashMap<Long, StaffImageOutVO>(staffVOs.size());
		HashMap<Long, HashMap<Long, Collection<CvPositionPDFVO>>> cvPositionVOMap = new HashMap<Long, HashMap<Long, Collection<CvPositionPDFVO>>>(staffVOs.size());
		Iterator<StaffOutVO> staffIt = staffVOs.iterator();
		while (staffIt.hasNext()) {
			StaffOutVO staffVO = staffIt.next();
			if (staffVO.isPerson()) {
				personVOs.add(staffVO);
				StaffAddressOutVO addressVO = findOrganisationCvAddress(staffVO, true, staffAddressDao);
				addressVOMap.put(staffVO.getId(), addressVO);
				imageVOMap.put(staffVO.getId(), staffDao.toStaffImageOutVO(staffDao.load(staffVO.getId())));
				HashMap<Long, Collection<CvPositionPDFVO>> staffPositionVOMap = new HashMap<Long, Collection<CvPositionPDFVO>>(allCvSections.size());
				Iterator<CvSectionVO> sectionIt = allCvSections.iterator();
				while (sectionIt.hasNext()) {
					CvSectionVO sectionVO = sectionIt.next();
					staffPositionVOMap.put(sectionVO.getId(), loadCvPositions(staffVO.getId(), sectionVO.getId(), cvPositionDao, courseParticipationDao));
				}
				cvPositionVOMap.put(staffVO.getId(), staffPositionVOMap);
			}
		}
		painter.setStaffVOs(personVOs);
		painter.setCvPositionVOMap(cvPositionVOMap);
		painter.setAddressVOMap(addressVOMap);
		painter.setImageVOMap(imageVOMap);
	}
	painter.setAllCvSectionVOs(allCvSections);
	return painter;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:36,代码来源:ServiceUtil.java


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