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

最新文章

  1. ubuntu14.04禁用guest用户登录
  2. -include和sinclude 作用
  3. Python脚本控制的WebDriver 常用操作 <二十> 处理表单元素
  4. Win7下配置nginx和php5
  5. Windows7 下安装ORACLE 11G(遇到的问题)
  6. MySQL分库分表备份脚本
  7. c#NPOI导出
  8. 从数据库中,绑定JQuery Accordion控件---Repeater control
  9. netflix ribbon概述
  10. 常见的cmd命令
  11. 切面编程AOP之Castle.Core
  12. 带权单源最短路[稀疏图](Dijkstra)
  13. (轉)EasyUI - DataGrid 去右边空白滚动条列
  14. selenium-键盘和鼠标事件
  15. Python初学者随笔Week1
  16. robotframework+Selenium2Library 模态窗口的处理
  17. [Node.js]26. Level 5 : Route rendering
  18. UVa 11297 Census (二维线段树)
  19. 【文文殿下】CF1029F Multicolored Markers
  20. 详解Python闭包,装饰器及类装饰器

热门文章

  1. WUSTOJ 1305: 最短路(Java)
  2. dotnet Core 图片验证码
  3. k8s安装ingress
  4. html页面在苹果手机内,safari浏览器,微信中滑动不流畅问题解决方案
  5. Visual Studio中找不到.Net Core SDK
  6. Eclipse下使用Maven创建项目出现的archetype错误,记,转
  7. MutationObserver
  8. (详细)Eclips+jsp+servlet+mysql+登录实例+源代码
  9. Java 之 字节输入流 [InputStream]
  10. 我对xss以及sql的理解