Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process of traversing foreach by Scala

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "Scala traversing foreach process". In daily operation, I believe many people have doubts about Scala traversing foreach process. Xiaobian consulted various materials and sorted out simple and easy operation methods. I hope to help you answer the doubts of "Scala traversing foreach process"! Next, please follow the small series to learn together!

##traverse foreach

list traversal

var l = List(1,2,3,4,5)l.foreach(i=>println(i))

map traversal

var m = Map("tony" -> 80, "bob" -> 90) m.foreach(kv => println(kv._ 1, kv._ 2))

##Map

val l = List("hive","hadoop","spark") val books= l.map(s=>s.toUpperCase) for(x s.toList) for(x

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report