当前位置:网站首页>iterator中的next()为什么要强转?
iterator中的next()为什么要强转?
2022-06-28 19:52:00 【Yuyy】
本文最后更新于 914 天前,其中的信息可能已经有所发展或是发生改变。
List<MyFile> myFileList=new LinkedList<>();
Iterator iterator=myFileList.iterator();
while (iterator.hasNext()){
MyFile myFile=(MyFile) iterator.next();
}- 因为迭代器没有定义泛型,next()默认会返回Object,所以需要强转。
- 加上泛型就OK,Iterator< MyFile> it = myFileList.iterator();
Post Views: 425
边栏推荐
- Software supply chain security risk guide for enterprise digitalization and it executives
- kettle(六):基于Kettle的数据库全量备份
- Use of WC command
- 2022年4月10日--使用C#迈出第一步--使用C#从.NET类库调用方法(没看懂)
- Why is it not enough to declare the structure alias when using the structure variable of other files in C language, and the proper name must be used? (cannot add struct when using alias)
- 28 rounds of interviews with 10 companies in two and a half years
- Autumn recruitment experience sharing | how to prepare for bank interview
- 各种类型长
- 2022年P气瓶充装考试练习题及在线模拟考试
- 【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
猜你喜欢

颜色渐变的FontAwesome图标

如何获取飞机穿过雷达两端的坐标

阿里开源(EasyExcel)

Leetcode week 299

csdn涨薪技术-Selenium自动化测试全栈总结

Markdown Mermaid Grass (1) Introduction à Mermaid

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MDd_DynamicDe

Demo of intelligent computing system 2 bangc operator development (heterogeneous programming flow of CPU and mlu270)

Intelligent computing system 1 environment construction

Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature
随机推荐
Can layoffs really save China's Internet?
2837. The total number of teams
Head, tail view file
2022焊工(初级)特种作业证考试题库及答案
Server configuration estimation of core IOT Bluetooth AOA positioning system
【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
rsync远程同步
2022茶艺师(中级)考试模拟100题及模拟考试
From design delivery to development, it is easy and efficient!
Gaozelong, a digital economy expert: Yingke changed its name to yingcosmos. Will yuancosmos become the next growth engine of Yingke?
怎么理解云原生数据库的易用性?
QSP读取标签配置错误问题
1002_ twenty million one hundred and eighty-one thousand and nineteen
Lecture 30 linear algebra Lecture 4 linear equations
社招两年半10个公司28轮面试面经
Troubleshooting of pyinstaller failed to pack pikepdf
Concours de segmentation des images gastro - intestinales de kaggle Baseline
集合之ArrayList
Design of secsha system
Markdown Mermaid Grass (1) Introduction à Mermaid