当前位置:网站首页>Copy ‘XXXX‘ to effectively final temp variable
Copy ‘XXXX‘ to effectively final temp variable
2022-07-01 22:59:00 【Xiaoqu classmate】
today , Used in projects lambda The expression encountered a problem :
Copy 'standDatasMap' to effectively final temp variable
Which translates as :xxxx Use valid final variables .
What does that mean ?
Let's have a look first ,lambda Rules for expressions :
- Only references to tags final The outer local variable of , That is to say, it can't be in lambda Internal modification of local variables defined outside the domain , Otherwise it will compile incorrectly .
- Local variables may not be declared as final, But it must not be modified by the following code ( That is to say, recessive has final The semantics of the )
- It is not allowed to declare a parameter or local variable with the same name as a local variable .
Write an example for you , Simple scenario reappearance :
reason :
This is because lambda Expressions do not accept dynamic parameters .
Revised as follows :
We can add one map, Used to receive dynamic parameters , This problem can be solved .
边栏推荐
- 毕业季,既是告别,也是新的开始
- 447 Bili Bili noodles warp 1
- 力扣 710. 黑名单中的随机数
- Using emqx cloud to realize one machine one secret verification of IOT devices
- leetcode - 287. Find duplicates
- [untitled]
- 使用3DMax制作一个象棋棋子
- Appium automation test foundation - appium installation (I)
- [daily training] 326 Power of 3
- Deadlock handling strategies - prevent deadlock, avoid deadlock, detect and remove deadlock
猜你喜欢
Introduction and use of plantuml
Stimulate new kinetic energy and promote digital economy in multiple places
Intelligent computing architecture design of Internet
思科考试--冗余网络
MySQL -- deduction of index storage model
常见的二十种软件测试方法详解(史上最全)
Cisco -- an external tool for WAN's concept examination
Explain JMM in detail
Use three JS realize the 'ice cream' earth, and let the earth cool for a summer
el-input文本域字数限制,超过显示变红并禁止输入
随机推荐
Favorite transaction code management tool in SAP GUI
Mysql database detailed learning tutorial
[literacy] deep / shallow, local / global features in machine learning image processing
Turn -- use setjmp and longjmp in C language to realize exception capture and collaboration
Tourism Management System
ECMAScript 2022 was officially released. Have you heard about it?
业务可视化-让你的流程图'Run'起来
每日刷题记录 (十)
Sogou wechat app reverse (II) so layer
Deep learning -- data operation
Efficiency improvement - encourage personalized container development environment
SAP 智能机器人流程自动化(iRPA)解决方案分享
cvpr2022 human pose estiamtion
"Trust machine" empowers development
Introduction and use of plantuml
Explain kubernetes network model in detail
nn.Parameter】Pytorch特征融合自适应权重设置(可学习权重使用)
死锁的处理策略—预防死锁、避免死锁、检测和解除死锁
SAP ui5 application development tutorial 104 - multi select support for SAP ui5 table controls and how to use code to select multiple table row items at a time
转--利用C语言中的setjmp和longjmp,来实现异常捕获和协程