learning scala How To Create Variable Argument Function - varargs :_ *
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
learning scala How To Create Variable Argument Function - varargs :_ *的更多相关文章
- learning scala How To Create Implicit Function
println("Step 1: How to create a wrapper String class which will extend the String type") ...
- learning scala akka actorySystem create and close
package com.example import akka.actor.ActorSystem import scala.util.{Failure, Success} import scala. ...
- c 可变参数(variable argument)的原理及使用
本文主要介绍可变参数的函数使用,然后分析它的原理,程序员自己如何对它们实现和封装,最后是可能会出现的问题和避免措施. VA函数(variable argument function),参数个数可变函数 ...
- How to create DB2 user function easily by DB Query Analyzer 6.03
How to create DB2user function easily by DB Query Analyzer 6.03 Ma Genfeng (Guangdong Unitoll Servic ...
- vs变量监视提示-VAR-CREATE: UNABLE TO CREATE VARIABLE OBJECT解决方法
昨天有个linux应用在使用vs 远程debug的时候,debug可以正常进行,但是监视变量的时候提示-VAR-CREATE: UNABLE TO CREATE VARIABLE OBJECT,经测试 ...
- GreenPlum学习笔记:create or replace function创建函数
原始表数据如下: 需求:现要求按分号“;”将rate_item列进行分割后插入到新的数据表中. CREATE OR REPLACE FUNCTION fun_gp_test_xxx_20181026( ...
- CREATE OR REPLACE FUNCTION
CREATE OR REPLACE FUNCTION SF_Taishou_Ksai_Date(v_receiptNum IN CHAR, ...
- CMake语法—普通变量与函数(Normal Variable And Function)
目录 CMake语法-普通变量与函数(Normal Variable And Function) 1 CMake普通变量与函数示例 1.1 CMakeLists.txt 1.2 执行CMake配置脚本 ...
- learning scala Function Recursive Tail Call
可以使用scala库,可以从字面上看出是在调用 递归函数: code import scala.util.control.TailCalls._ val arrayDonuts: Array[Stri ...
随机推荐
- k8s开发实践
代码自动生成:https://blog.openshift.com/kubernetes-deep-dive-code-generation-customresources/ 自定义controlle ...
- nginx与php配置用户问题
当配置nginx的nginx.conf 时,可参照如下配置: server { listen 80; server_name www.advancephp2017.com; access_log lo ...
- Linux安装JDK,Tomcat,Mysql+部署项目
安装VMWare虚拟机 下载地址(http://www.onlinedown.net/soft/2062.htm) 安装步骤很简单(除了选择安装路径),傻瓜式安装 同意协议 选择安装路径 安装 完成 ...
- stm32f103的低功耗开启和关闭
stm32f103低功耗分为WFI等待中断和WFE等待事件,我只用到等待中断,这里没有细究. 待机模式最低功耗2uA,只有备份寄存器和待机电路供电,PLL,HSI,HSE断开,寄存器和SRAM复位,除 ...
- vijo 1456最小总代价
题意:中文题... 题解:状态比较多,可以说是状压的基础题吧,我们定义dp[i][j],j为一个二进制数,每位0表示接触过该物品,1表示没有接触过;j表示当前物品在谁手上.递推的顺序注意一下就好 ac ...
- C#-Parallel
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Li ...
- tslint 忽略格式检查
// tslint:disable——忽略该行以下所有代码出现的错误提示,可以在文件首行添加达到忽略整个文件的格式提示 // tslint:enable——当前ts文件重新启用tslint// tsl ...
- git bash push 本地的commit到远程 -- ssh keys设置
1. 检查是否已经创建 ssh keys git bash 下,cd ~/.ssh 如何出现“No such file or directory”,则表示需要创建一个ssh keys. 2. 创建新 ...
- ES6-promise实现异步请求
一.Promise是什么 简单说就是一个容器,里面保存着某个未来才会结束的事件(通常是一个异步操作)的结果. ES6规定,Promise对象是一个构造函数,用来生成Promise实例.Promise构 ...
- 安卓开发之生成cache目录和files目录
package com.lidaochen.test; import android.os.Bundle; import android.support.v7.app.AppCompatActivit ...