当前位置:网站首页>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
边栏推荐
- Kaggle腸胃道圖像分割比賽baseline
- R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions
- C # connect to the database to complete the operation of adding, deleting, modifying and querying
- 管道 | 与重定向 >
- 2022 welder (elementary) special operation certificate examination question bank and answers
- Can layoffs really save China's Internet?
- Paper notes: universal value function approvers
- 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2038 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MDd_DynamicDe
- Time series forecasting based on trend and seasonality
- R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
猜你喜欢

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

Markdown Mermaid Grass (1) Introduction à Mermaid

计网 | 一文解析TCP协议所有知识点

【324. 摆动排序 II】

Software supply chain security risk guide for enterprise digitalization and it executives

Industry analysis - quick intercom, building intercom

2022 welder (elementary) special operation certificate examination question bank and answers

数论 --- 欧拉函数、筛法求欧拉函数、欧拉定理、费马小定理详细证明

2022 P cylinder filling test exercises and online simulation test

Autumn recruitment experience sharing | how to prepare for bank interview
随机推荐
jsp中获取session中的值
odoo15 Module operations are not possible at this time, please try again later or contact your syste
Kaggle腸胃道圖像分割比賽baseline
ROS中quaternion四元數和歐拉角轉換
Fontawesome icon for color gradient
《数据安全法》出台一周年,看哪四大变化来袭?
Database learning notes (sql04)
wc命令的使用
社招两年半10个公司28轮面试面经
Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature
如何获取飞机穿过雷达两端的坐标
1002_ twenty million one hundred and eighty-one thousand and nineteen
2022茶艺师(中级)考试模拟100题及模拟考试
return new int[]{i + 1, mid + 1};return {i + 1, mid + 1};
QSP读取标签配置错误问题
How does redis implement inventory deduction? How to prevent oversold?
JSP to get the value in the session
SQL server2019 create a new SQL server authentication user name and log in
【Go语言刷题篇】Go从0到入门5:Map综合复习、条件语句、循环语句练习
The severity code indicates that the project file line prohibits the display of status errors. C1047 object or library file ".Lib" is different from other objects (such as "x64\release\main.obj")