使用可迭代的接口 [英] using the iterable interface

查看:135
本文介绍了使用可迭代的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实现可迭代行的类表,我已经实现了以下方法:hasnext,next和remove.my问题是我不知道如何实现以下方法iterator.just以防万一你想知道我有一个全局变量行是一个行数组

i have a class table which implements iterable row,i have implemented the following methods:hasnext,next and remove.my problem is that i dont know how to implement the following method iterator.just in case you are wondering i have a global variable rows which is an array of row

推荐答案

Iterable不需要您实现的那些方法。您只需要迭代器方法实现。你是在实现Iterable,Iterator还是两者?
Those methods you have implemented are not required for an Iterable. All you need is the iterator method implementation. Are you implementing Iterable, Iterator or both?



Iterable不需要你实现的那些方法。您只需要迭代器方法实现。你是在实现Iterable,Iterator还是两者兼而有之?
Those methods you have implemented are not required for an Iterable. All you need is the iterator method implementation. Are you implementing Iterable, Iterator or both?



i只想实现迭代,但我不知道如何实现迭代器方法

i just want to implement the iterable but i dont know how to implement the iterator method



i只想实现迭代,但我不知道如何实现迭代器方法
i just want to implement the iterable but i dont know how to implement the iterator method



你的表基于什么?

What is your table based upon?


这篇关于使用可迭代的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆