learning scala How To Create Variable Argument Function - varargs :_ *
2024-10-21 04:13:02
Scala collection such as List or Sequence or even an Array to variable argument function using the syntax :_ *.
code :
def printReport(names: String*) {
println(s"""Donut Report = ${names.mkString(" - ")}""")
} println("\nStep 3: How to pass a List to a function with variable number of arguments")
val listDonuts: List[String] = List("Glazed Donut", "Strawberry Donut", "Vanilla Donut")
printReport(listDonuts: _*)
result:
Step : How to pass a List to a function with variable number of arguments
Donut Report = Glazed Donut - Strawberry Donut - Vanilla Donut
最新文章
- ubuntu14.04禁用guest用户登录
- -include和sinclude 作用
- Python脚本控制的WebDriver 常用操作 <;二十>; 处理表单元素
- Win7下配置nginx和php5
- Windows7 下安装ORACLE 11G(遇到的问题)
- MySQL分库分表备份脚本
- c#NPOI导出
- 从数据库中,绑定JQuery Accordion控件---Repeater control
- netflix ribbon概述
- 常见的cmd命令
- 切面编程AOP之Castle.Core
- 带权单源最短路[稀疏图](Dijkstra)
- (轉)EasyUI - DataGrid 去右边空白滚动条列
- selenium-键盘和鼠标事件
- Python初学者随笔Week1
- robotframework+Selenium2Library 模态窗口的处理
- [Node.js]26. Level 5 : Route rendering
- UVa 11297 Census (二维线段树)
- 【文文殿下】CF1029F Multicolored Markers
- 详解Python闭包,装饰器及类装饰器
热门文章
- WUSTOJ 1305: 最短路(Java)
- dotnet Core 图片验证码
- k8s安装ingress
- html页面在苹果手机内,safari浏览器,微信中滑动不流畅问题解决方案
- Visual Studio中找不到.Net Core SDK
- Eclipse下使用Maven创建项目出现的archetype错误,记,转
- MutationObserver
- (详细)Eclips+jsp+servlet+mysql+登录实例+源代码
- Java 之 字节输入流 [InputStream]
- 我对xss以及sql的理解