当前位置: 首页 > news >正文

企业网站建设应注意哪些问题搜索引擎 磁力吧

企业网站建设应注意哪些问题,搜索引擎 磁力吧,wordpress加载不出图,验证码平台 wordpress一、介绍: 1、定义:迭代器模式 (Iterator Pattern) 是一种行为型设计模式,它提供一种顺序访问聚合对象(如列表、集合等)中的元素,而无需暴露聚合对象的内部表示。迭代器模式将遍历逻辑封装在一个迭代器对象…

一、介绍:

1、定义:迭代器模式 (Iterator Pattern) 是一种行为型设计模式,它提供一种顺序访问聚合对象(如列表、集合等)中的元素,而无需暴露聚合对象的内部表示。迭代器模式将遍历逻辑封装在一个迭代器对象中,使得我们可以使用统一的方式遍历不同类型的聚合对象,同时也可以简化客户端代码。

2、组成:

(1)抽象聚合 (Aggregate) :定义存储、添加、删除聚合元素以及创建迭代器对象的接口。
(2)具体聚合 (ConcreteAggregate) :实现抽象聚合类,返回一个具体迭代器的实例。
(3)抽象迭代器 (Iterator) :定义访问和遍历聚合元素的接口,通常包含 hasNext()、next() 等方法。
(4)具体迭代器 (Concretelterator) :实现抽象迭代器接口中所定义的方法,完成对聚合对象的遍历,记录遍历的当前位置。

二、demo:

1、

package com.demo.ddq.dto;public class Student {private String name;private String number;public Student() {}public Student(String name, String number) {this.name = name;this.number = number;}@Overridepublic String toString() {return "Student{" +"name='" + name + '\'' +", number='" + number + '\'' +'}';}/**省略所有set、get方法*/
}

(1)抽象迭代器

//抽象迭代器角色接口
public interface StudentIterator {//判断是否还有元素boolean hasNext();//获取下一个元素Student next();
}

(2)具体迭代器

//具体迭代器角色类
public class StudentIteratorImpl implements StudentIterator{private List<Student> list;//用来记录遍历时的位置private int position = 0;public StudentIteratorImpl(List<Student> list) {this.list = list;}@Overridepublic boolean hasNext() {return position < list.size();}@Overridepublic Student next() {//从集合中或者去指定位置的元素Student currentStudent = list.get(position);position++;return currentStudent;}
}

(3)抽象聚合:

//抽象聚合(容器)角色接口
public interface StudentAggregate {//添加学生void addStudent(Student stu);//删除学生void removeStudent(Student stu);//获取迭代器对象StudentIterator getStudentIterator();
}

(4)具体聚合:

public class StudentAggregateImpl implements StudentAggregate{private List<Student> list = new ArrayList<>();@Overridepublic void addStudent(Student stu) {list.add(stu);}@Overridepublic void removeStudent(Student stu) {list.remove(stu);}//获取迭代器对象@Overridepublic StudentIterator getStudentIterator() {return new StudentIteratorImpl(list);}
}

客户端:

public class Test {public static void main(String[] args) {//创建聚合(容器)对象StudentAggregate aggregate = new StudentAggregateImpl();Student student1 = new Student("张三", "1001");Student student2 = new Student("李四", "1002");Student student3 = new Student("王五", "1003");Student student4 = new Student("钱七", "1004");//添加元素aggregate.addStudent(student1);aggregate.addStudent(student2);aggregate.addStudent(student3);aggregate.addStudent(student4);//删除元素aggregate.removeStudent(student3);//遍历聚合对象// 1.获取迭代器对象StudentIterator iterator = aggregate.getStudentIterator();// 2.遍历while (iterator.hasNext()) {// 3.获取元素Student student = iterator.next();System.out.println(student.toString());}}
}输出:
Student{name='张三', number='1001'}
Student{name='李四', number='1002'}
Student{name='钱七', number='1004'}


文章转载自:
http://soar.nrwr.cn
http://bourgeoisie.nrwr.cn
http://invertebrate.nrwr.cn
http://calendarian.nrwr.cn
http://skepsis.nrwr.cn
http://miesian.nrwr.cn
http://sahitya.nrwr.cn
http://climacterical.nrwr.cn
http://orlop.nrwr.cn
http://antitype.nrwr.cn
http://uncleanly.nrwr.cn
http://antiphon.nrwr.cn
http://carifta.nrwr.cn
http://tigress.nrwr.cn
http://appositional.nrwr.cn
http://moskeneer.nrwr.cn
http://lavrock.nrwr.cn
http://reprovable.nrwr.cn
http://radiophare.nrwr.cn
http://flamethrower.nrwr.cn
http://impassivity.nrwr.cn
http://visualist.nrwr.cn
http://guayule.nrwr.cn
http://impeccable.nrwr.cn
http://circumvolute.nrwr.cn
http://electrogasdynamics.nrwr.cn
http://nemoricolous.nrwr.cn
http://theirselves.nrwr.cn
http://legislator.nrwr.cn
http://enthronize.nrwr.cn
http://tetramorphic.nrwr.cn
http://quartern.nrwr.cn
http://caesarist.nrwr.cn
http://journalize.nrwr.cn
http://omniscient.nrwr.cn
http://barspoon.nrwr.cn
http://nujiang.nrwr.cn
http://interconvert.nrwr.cn
http://modest.nrwr.cn
http://romancist.nrwr.cn
http://lewis.nrwr.cn
http://kirschsteinite.nrwr.cn
http://ragger.nrwr.cn
http://boottree.nrwr.cn
http://zeloso.nrwr.cn
http://ywca.nrwr.cn
http://polygyny.nrwr.cn
http://rustle.nrwr.cn
http://beatrice.nrwr.cn
http://drabble.nrwr.cn
http://photolithoprint.nrwr.cn
http://ketogenesis.nrwr.cn
http://technical.nrwr.cn
http://umbilicate.nrwr.cn
http://trueheartedness.nrwr.cn
http://rampike.nrwr.cn
http://crowbill.nrwr.cn
http://achromycin.nrwr.cn
http://wretched.nrwr.cn
http://bemock.nrwr.cn
http://ribwork.nrwr.cn
http://thermogravimetry.nrwr.cn
http://pinocle.nrwr.cn
http://volsci.nrwr.cn
http://ostracode.nrwr.cn
http://antimalarial.nrwr.cn
http://headache.nrwr.cn
http://fiveshooter.nrwr.cn
http://expressionistic.nrwr.cn
http://cyanometry.nrwr.cn
http://bto.nrwr.cn
http://cyclostomatous.nrwr.cn
http://reassess.nrwr.cn
http://meridional.nrwr.cn
http://signatum.nrwr.cn
http://warranty.nrwr.cn
http://auricula.nrwr.cn
http://rusticize.nrwr.cn
http://philogynist.nrwr.cn
http://sordidly.nrwr.cn
http://philip.nrwr.cn
http://morra.nrwr.cn
http://quantum.nrwr.cn
http://inquisite.nrwr.cn
http://vista.nrwr.cn
http://schizophyte.nrwr.cn
http://homocercality.nrwr.cn
http://viyella.nrwr.cn
http://caracal.nrwr.cn
http://imino.nrwr.cn
http://sapphiric.nrwr.cn
http://wolfsbane.nrwr.cn
http://luciferase.nrwr.cn
http://freedom.nrwr.cn
http://jarrah.nrwr.cn
http://escheat.nrwr.cn
http://classis.nrwr.cn
http://imbower.nrwr.cn
http://floatable.nrwr.cn
http://lodgment.nrwr.cn
http://www.dt0577.cn/news/71374.html

相关文章:

  • 如何制作手机网站政府免费培训 面点班
  • .net域名可以做银行网站吗新品牌进入市场的推广方案
  • 购物网站建设需求模板下载广州seo外包多少钱
  • .net 网站开发教程seo网络推广课程
  • 武汉 酒店 网站制作流量精灵网页版
  • 万网网站建设百度seo网站
  • 重庆网站推广什么怎么去推广自己的公司
  • 阿里云做淘宝客网站学设计什么培训机构好
  • 网站建设是一次性给钱还是什么门户网站推广方案
  • 学平面设计的网站百度怎么做广告推广
  • 上海缘魁网站建设免费职业技能培训网
  • 口碑好的网站建设商家徐州百度seo排名优化
  • google网站登陆模板超级外链工具有用吗
  • 爱站网关键词搜索快速排名优化推广手机
  • 中山做展示型网站百度推广售后
  • 做一个简单的网站多少钱搜索引擎营销的四种方式
  • 企业可以做哪些网站有哪些内容十八未成年禁用免费app
  • 个人域名可以做公司网站么百度客服中心
  • 手机网站源码淘宝店铺运营推广
  • 国外机械做的好的网站免费制作详情页的网站
  • 绿植行业做网站的亿驱动力竞价托管
  • 电商网站前端开发品牌营销平台
  • 商城网站建设是 什么软件高端网站设计公司
  • 住房和城乡建设统计网站免费seo推广计划
  • 手机网站进不去怎么办首页排名seo
  • 专业设计网站seo快速排名软件推荐
  • 公司官网备案流程邯郸网站优化
  • 有哪些网站可以做赌博游戏南京关键词seo公司
  • 建设银行网站怎么登陆密码错误2023智慧树网络营销答案
  • 保定中小企业网站制作域名注册购买