当前位置:网站首页>Scala idea prompt function parameters
Scala idea prompt function parameters
2022-07-23 07:50:00 【Wu Nian】
Catalog
scala list.map Use
def main(args: Array[String]): Unit = {
val list: List[(String, Int)] = List(("a", 1), ("b", 2), ("c", 3))
// Statistics wordcount
val newList: List[(String, Int)] = list.map(t => {
(t._1, t._2 * 2)
})
println(newList) // Output List((a,2), (b,4), (c,6))
}
- list.map() This function requires a parameter to be passed in , What type of parameter is this ?

The required parameters are Function type namely () =>{}, The parameters of this function are tuples , namely (string, int), The return type is B( This B I don't understand )
The above complete writing is
val newList: List[(String, Int)] = list.map((t: (String, Int)) => {
(t._1, t._2 * 2)
})
- How to simplify it ?
Please refer to : Anonymous functions and Simplification principle of anonymous functions
边栏推荐
- 如何在 PHP 应用程序中预防SQL 注入
- 文件上传,服务器文件名中文乱码文件上传,服务器文件名中文乱码
- Mysql无法访问,navicat提示:is not allowed to connect to this MySQL server
- 局域网SDN技术硬核内幕 10 云网融合的红娘EVPN
- 升级poi-tl版本1.12.0与旧版poi(4.1.2)、easyexcel之间的依赖冲突解决
- Application of the latest version of Ontrack easyrecovery computer data recovery software
- Here comes the genuine Adobe software! Adobe's only genuine family bucket subscription in the world costs only 0 yuan / year
- Z-Wave 800:SE 固件升级
- Custom view: levitation ball and accelerator ball
- 【刷题记录】18. 四数之和
猜你喜欢

网络安全之ARP欺骗防护

景联文科技提供3D点云-图像标注服务

真人踩过的坑,告诉你避免自动化测试常犯的10个错误

Draw a wave ball with the curve of flutter and Bessel

Z-Wave 800:SE 固件升级

Why does MySQL index use b+ tree instead of jump table?

7. Learn Mysql to select a database

2022就业季惊喜来袭!正版Adobe软件,终于能正经白嫖一把了

驱动页面性能优化的3个有效策略
![[technology popularization] alliance chain layer2- on a new possibility](/img/e1/be9779eee3d3d4dcf56e103ba1d3d6.jpg)
[technology popularization] alliance chain layer2- on a new possibility
随机推荐
ROS based navigation framework
局域网SDN硬核技术内幕 21 亢龙有悔——规格与限制(中)
Mysql的索引为什么用B+树而不是跳表?
I use the factory mode in jd.com and explain the factory mode clearly
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
002_Kubernetes安装配置
Kubernetes 部署策略
局域网SDN技术硬核内幕 - 16 三 从物到人 园区用户漫游的EVPN实现
Classes and objects (1)
Mysql无法访问,navicat提示:is not allowed to connect to this MySQL server
Leetcode 757 set the intersection size to at least 2[sort greedy] the leetcode path of heroding
亚马逊旗下Zoox通过安全测试 并在加州申请试驾
局域网SDN硬核技术内幕 19 团结一切可以团结的力量
Electronic bidding procurement mall system: optimize traditional procurement business and speed up enterprise digital upgrading
scala 主构造器_Scala主构造器深度
Uniapp switches the tab bar to display different pages, remembers the page location and pulls up to get new data
网络安全之ARP欺骗防护
redis 哨兵模式,主节点检查脚本
Part I sourcetree installation
我是如何在一周内拿到4份offer的?