迭代器模式
2020-06-14 13:14:58 15 举报
迭代器模式
作者其他创作
大纲/内容
City
- name:String
+ City(name)+ getName():String+ setName(name):void
Iterator
hasNext():booleannext():Eremove():void
GunangDongProvince
-citys:List<City>
+GunangDongProvince()+getName():String+addCity(name):void+createIterator():Iterator
Province
getName():StringaddCity(name):voidcreateIterator():Iterator
HeNanProvince
- citys:City []- citysize:int
+HeNanProvince()+getName():String+addCity(name):void+createIterator():Iterator
OutPutImpl
-provinces:List<Province>
+ OutPutImpl(provinces)+ print()+ printCity(iterator):void
HeNanProvinceIterator
- citys:City []- position:int = 0
+HeNanProvinceIterator(citys:City[])+hasNext():boolean+next():Object
GuangDongProvinceIterator
- citys:List<City>- index:int = -1
+GuangDongProvinceIterator(citys:List<City>)+hasNext():boolean+next():Object
0 条评论
下一页