本文整理汇总了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;
}
示例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());
}
示例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()))
);
}
}
示例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());
}
示例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);
}
示例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;
}
}
示例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();
}
}
}
示例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!");
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}