当前位置:网站首页>Variable used in lambda expression should be final or effectively final报错解决方案
Variable used in lambda expression should be final or effectively final报错解决方案
2022-08-09 06:41:00 【时间是一种解药】
Variable used in lambda expression should be final or effectively final报错解决方案
问题背景
在使用forEach报错:Variable used in lambda expression should be final or effectively final,意思是:lambda表达式中的变量应为最终变量或为有效的最终变量
而我的写的是,removeKey和removeValue都是局部变量,不满足最终变量的有效性
解决方案
1 把最终变量变为全局变量具有最终有效性即可
作为程序员第 221 篇文章,每次写一句歌词记录一下,看看人生有几首歌的时间,wahahaha …
Lyric: 哪里都是你
边栏推荐
猜你喜欢
随机推荐
io.lettuce.core。RedisCommandTimeoutException命令超时
APP商品详情源数据接口(淘宝/京东/拼多多/苏宁/抖音等平台详情数据分析接口)代码对接教程
.NET高级技术
CalBioreagents超全Id 蛋白兔单克隆抗体,助力科研
运算放大器(OPA)超详细参数讲解-运放---以及8个型号的运算放大器分析对比
电学知识的疑问
长沙学院2022暑假训练赛(一)六级阅读
Simple to use Lambda expressions
Remember a nest.js route that matches all the path problems that follow
Transaction concluded
Example of using the cut command
Thread Pool Summary
使用百度EasyDL实现智能垃圾箱
缓存技术使用
代码目录结构
Output method of list string print(*a) print(““.join(str(c) for c in a) )
shardingsphere data sharding configuration item description and example
crc calculation
数据库中间件-jdbi
图论,二叉树,dfs,bfs,dp,最短路专题