# 函数具体用法

</font>def ++[B >: A, That](that : scala.collection.GenTraversableOnce[B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3)
val b=Array(4,5,6)
val c=List(7,8,9)
val d=a++b	//d: Array[Int] = Array(1, 2, 3, 4, 5, 6)
val d=a++c	//d: Array[Int] = Array(1, 2, 3, 7, 8, 9)
val d=c++a	//d: List[Int] = List(7, 8, 9, 1, 2, 3)


def ++:[B >: A, That](that: collection.Traversable[B])(implicit bf: CanBuildFrom[Array[T], B, That]): That


val a=List(1,2)


def /:[B](z: B)(op: (B, T) => B): B


val a=List(1,2,3,4)
val b=(10/:a)(_+_)	//b: Int = 20
//	(((10+1)+2)+3)+4
val b=(10/:a)(_*_)	//b: Int = 240
//	(((10*1)*2)*3)*4


def :+(elem: A): Array[A]


val a=List(1,2)
val b=a:+3	//b: List[Int] = List(1, 2, 3)


def :[B](z: B)(op: (T, B) ⇒ B): B


val a=List(1,2,3,4)
val b=(a:\10)(_-_)	//b: Int = 8
//	1-(2-(3-(4-10)))
val b=(a:\10)(_*_)	//b: Int = 240
//	1*(2*(3*(4*10)))


def +:[B >: Int](elem: B)(implicit evidence\$3: scala.reflect.ClassTag[B]): Array[B]


val a=List(1,2)
val b=3+:a	//b: List[Int] = List(3, 1, 2)


def addString(b : scala.StringBuilder, start : scala.Predef.String, sep : scala.Predef.String, end : scala.Predef.String) : scala.StringBuilder = { /* compiled code */ }
def addString(b : scala.StringBuilder, sep : scala.Predef.String) : scala.StringBuilder = { /* compiled code */ }
def addString(b : scala.StringBuilder) : scala.StringBuilder = { /* compiled code */ }


• 第一种
val a=List(1,2,3,4)
val b=new StringBuilder()

• 第二种
val a=List(1,2,3,4)
val b=new StringBuilder()

• 第三种
val a=List(1,2,3,4)
val b=new StringBuilder()


def aggregate[B](z: ⇒ B)(seqop: (B, T) ⇒ B, combop: (B, B) ⇒ B): B


//为了方便理解，把aggregate的两个参数分别封装成两个方法，并把分区和不分区的计算过程打印出来
def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def combine(m: Int, n: Int): Int = {
val s = "com_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = List(1, 2, 3, 4)

val b = a.aggregate(5)(seqno, combine) // 不分区
println("b = " + b)
/**
* seq_exp = 5 + 1
* seq_exp = 6 + 2
* seq_exp = 8 + 3
* seq_exp = 11 + 4
* b = 15
*/

val c = a.par.aggregate(5)(seqno, combine) // 分区
println("c = " + c)
/**
* seq_exp = 5 + 3
* seq_exp = 5 + 2
* seq_exp = 5 + 4
* seq_exp = 5 + 1
* com_exp = 6 + 7
* com_exp = 8 + 9
* com_exp = 13 +17
* c = 30
*/
}


a.par.aggregate(5)(_+_)(_+_)


override def andThen[C](k : scala.Function1[B, C]) : scala.PartialFunction[A, C] = { /* compiled code */ }


def f(a:Int) = {
println("2*"+a)
2*a
}

def g(b:Int) = {
println("3*"+b)
3*b
}

def  result1 = f _ andThen g _
println(result1(1))
/*
2*1
2*3
6
*/
def  result2 = f _ compose  g _
println(result2(1))
/*
3*1
3*2
6
*/


def apply(i : scala.Int) : T = { /* compiled code */ }


val a = Array(1,2,3,4)
a.apply(2)	//Int = 3
//等同于
a(2)	//Int = 3


def applyOrElse[A1 <: A, B1 >: B](x : A1, default : scala.Function1[A1, B1]) : B1 = { /* compiled code */ }


val pf1:PartialFunction[Int,String]={//定义一个偏函数，输入1返回“one”
case i if i==1=>"one"
}	//pf1: PartialFunction[Int,String] = <function1>
pf1.applyOrElse(1,{num:Int=>"two"})	//String = one
pf1.applyOrElse(2,{num:Int=>"two"})	//String = two
pf1.applyOrElse(3,{num:Int=>"two"})	//String = two


val arr=Array(1,2,3,4)	//arr: Array[Int] = Array(1, 2, 3, 4)
val first=arr(0)	//first: Int = 1
val newarr=arr.map(_*2)	//newarr: Array[Int] = Array(2, 4, 6, 8)
println(newarr.mkString(","))	//2,4,6,8


def canEqual(that: Any): Boolean


val a=List(1,2,3,4)
val b=Array('a','b','c')
a.canEqual(b)	//Boolean = true


def clone(): Array[T]


val a=Array(1,2,3,4)
val b=a.clone	//b: Array[Int] = Array(1, 2, 3, 4)


 def collect[B, That](pf : scala.PartialFunction[A, B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val fun:PartialFunction[Char,Char]={
case 'a'=>'A'
case x=>x
}	//fun: PartialFunction[Char,Char] = <function1>
val a=Array('a','b','c')
val b=a.collect(fun)	//b: Array[Char] = Array(A, b, c)


def collectFirst[B](pf: PartialFunction[T, B]): Option[B]


 val fun:PartialFunction[Any,Int]={
case x:Int=>x+1
}
val a=Array('a',1,3,"A")
val b=a.collectFirst(fun)	//b: Option[Int] = Some(2)


def combinations(n : scala.Int) : scala.collection.Iterator[Repr] = { /* compiled code */ }


val a=Array("a","b","c")
val b=a.combinations(2)	//b: Iterator[Array[String]] = non-empty iterator
b.foreach(x=>println(x.mkString(",")))
/*
a,b
a,c
b,c
*/


override def companion : scala.collection.generic.GenericCompanion[scala.collection.mutable.IndexedSeq] = { /* compiled code */ }


def f(a:Int) = {
println("2*"+a)
2*a
}

def g(b:Int) = {
println("3*"+b)
3*b
}

def  result1 = f _ andThen g _
println(result1(1))
/*
2*1
2*3
6
*/
def  result2 = f _ compose  g _
println(result2(1))
/*
3*1
3*2
6
*/


override def contains[A1 >: A](elem : A1) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
a.contains(2)	//Boolean = true


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(2,3)
val c=Array(2,4,5)
a.containsSlice(b)	//Boolean = true
a.containsSlice(c)	//Boolean = false


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3)
val b:Array[Int]=new Array(10)	//b: Array[Int] = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
a.copyToArray(b)
b.foreach(print)	//1230000000
a.copyToArray(b,4,2)	//从第五位引入两个数字
b.foreach(print)	//1230120000


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


//引入ArrayBuffer jar包
import scala.collection.mutable.ArrayBuffer
val a=Array(1,2,3,4)
val b:ArrayBuffer[Int]=ArrayBuffer()	//b: scala.collection.mutable.ArrayBuffer[Int] = ArrayBuffer()
a.copyToBuffer(b)
b.foreach(print)	//1234


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(5,6,7,8)
val c=Array(2,1,4,5)
a.corresponds(b)(_<_)	//Boolean = true
a.corresponds(c)(_<_)	//Boolean = false


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
a.count(_>2)	//Int = 2


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(3,4,5,6)
val c=a.diff(b)	//c: Array[Int] = Array(1, 2)


def distinct : Repr = { /* compiled code */ }


val a=Array(1,2,2,3,3,4,4)
val b=a.distinct	//b: Array[Int] = Array(1, 2, 3, 4)


override def drop(n : scala.Int) : Repr = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.drop(2)	//b: Array[Int] = Array(3, 4)


verride def dropRight(n : scala.Int) : Repr = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.dropRight(2)	//b: Array[Int] = Array(1, 2)


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4,3,2,1)
val b=a.dropWhile(_<3)	//b: Array[Int] = Array(3, 4, 3, 2, 1)
val a=Array(1,2,3,4,3,2,1)
val b=a.dropWhile(_>2)	//b: Array[Int] = Array(1, 2, 3, 4, 3, 2, 1)


def elemManifest: ClassManifest[Int]


def elemTag: scala.reflect.ClassTag[Int]


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(3,4)
a.endsWith(b)	//Boolean = true


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
a.exists(_==3)	//Boolean = true
a.exists(_==5)	//Boolean = false


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.filter(_>2)	//b: Array[Int] = Array(3, 4)


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4,0)
val b=a.filterNot(_>2)	//b: Array[Int] = Array(1, 2, 0)


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.find(_>2)	//b: Option[Int] = Some(3)


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.flatMap(x=>1 to x)	//b: Array[Int] = Array(1, 1, 2, 1, 2, 3, 1, 2, 3, 4)
/*
1
1,2
1,2,3
1,2,3,4
*/

//与map的区别
val c = a.map(x => 1 to x)
println(c.mkString(","))  //分别返回4个数组  Range(1),Range(1, 2),Range(1, 2, 3),Range(1, 2, 3, 4)

//展开一个Array[Array]类型的数组
val arr = Array(Array(1, 2, 3), Array(4, 5, 6), Array(7, 8, 9))
val ints = arr.flatMap(x => x)
println(ints.mkString(","))  //展开arr中每一个数组元素  1,2,3,4,5,6,7,8,9


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(Array(1,2,3),Array(4,5,6))
val b=a.flatten	//b: Array[Int] = Array(1, 2, 3, 4, 5, 6)


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)

val b = a.fold(5)(seqno) // 不分区
println("b = " + b)
/*
* seq_exp = 5 + 1
* seq_exp = 6 + 2
* seq_exp = 8 + 3
* seq_exp = 11 + 4
* b = 15
*/

val c = a.par.fold(5)(seqno) // 分区
println("c = " + c)
/*
* seq_exp = 5 + 3
* seq_exp = 5 + 2
* seq_exp = 5 + 4
* seq_exp = 5 + 1
* com_exp = 6 + 7
* com_exp = 8 + 9
* com_exp = 13 + 17
* c = 30
*/
}


val b=a.fold(5)(_+_)	//b: Int = 15
val c=a.par.fold(5)(_+_)	//c: Int = 30


def foldLeft[B](z: B)(op: (B, T) ⇒ B): BClassTag[U]): Array[U]


def /:[B](z: B)(op: (B, T) ⇒ B): B

def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]): Unit = {
val a = Array(1, 2, 3, 4)

val b = a.foldLeft(5)(seqno) // 简写: (5 /: a)(_ + _)
println("b = " + b)
/**
* seq_exp = 5 + 1
* seq_exp = 6 + 2
* seq_exp = 8 + 3
* seq_exp = 11 + 4
* b = 15
*/
}


(5 /: a)(_ + _)	//Int = 15


foldRight[B](z: B)(op: (B, T) ⇒ B): B


def :[B](z: B)(op: (T, B) ⇒ B): B

def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]): Unit = {
val a = Array(1, 2, 3, 4)

val b = a.foldRight(5)(seqno) // 简写: (a :\ 5)(_ + _)
println("b = " + b)
/**
* seq_exp = 4 + 5
* seq_exp = 3 + 9
* seq_exp = 2 + 12
* seq_exp = 1 + 14
* b = 15
*/
}


(a :\ 5)(_ + _)	//Int = 15


def forall(p: (T) ⇒ Boolean): Boolean


val a=Array(1,2,3,4)
a.forall(_>0)	//Boolean = true
a.forall(_>2)	//Boolean = false


def foreach(f: (A) ⇒ Unit): Unit


val a=Array(1,2,3,4)
a.foreach(x=> println(x * 10))
/**
* 10
* 20
* 30
* 40
*/


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
a.groupBy(_>2)	// scala.collection.immutable.Map[Boolean,Array[Int]] = Map(false -> Array(1, 2), true -> Array(3, 4))


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4,5)
a.grouped(3)	//生成的结果是一个迭代器：Iterator[Array[Int]] = non-empty iterator
a.grouped(3).toList	//将迭代器转成List输出：List[Array[Int]] = List(Array(1, 2, 3), Array(4, 5))


def hasDefiniteSize : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4,5)
a.hasDefiniteSize	//Boolean = true
.grouped(3).hasDefiniteSize	//例如迭代器：Boolean = false


override def head : A = { /* compiled code */ }


val a=Array(1,2,3,4)


def headOption : scala.Option[A] = { /* compiled code */ }


val a=Array(1,2,3,4)
val b:Array[Int]=Array()
b.head	//报错：java.util.NoSuchElementException: next on empty iterator


def indexOf[B >: A](elem : B) : scala.Int = { /* compiled code */ }


val a=Array(1,2,3,4,2,3)
a.indexOf(3)	//Int = 2
a.indexOf(3,4)	//Int = 5


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4,5,2,3,6,7,2,3)
val b=Array(2,3)
a.indexOfSlice(b)	//Int = 1
a.indexOfSlice(b,3)	//Int = 5


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
a.indexWhere(_>2)	//Int = 2
a.indexWhere(_>2,3)	//Int = 3


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.indices	//b: scala.collection.immutable.Range = Range(0, 1, 2, 3)


override def init : Repr = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.init	//b: Array[Int] = Array(1, 2, 3)


def inits : scala.collection.Iterator[Repr] = { /* compiled code */ }


val a = Array(1, 2, 3, 4)
val b = a.inits.toList	//b: List[Array[Int]] = List(Array(1, 2, 3, 4), Array(1, 2, 3), Array(1, 2), Array(1), Array())
for (i <- 0 until b.length) {
val s = "第 %d 个值: %s"
println(s.format(i + 1, b(i).mkString(",")))
}
/*
* 第 1 个值: 1,2,3,4
* 第 2 个值: 1,2,3
* 第 3 个值: 1,2
* 第 4 个值: 1
* 第 5 个值:
*/


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(3,4,5,6)
val c=a.intersect(b)	//c: Array[Int] = Array(3, 4)


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
a.isDefinedAt(1)	//Boolean = true
a.isDefinedAt(5)	//Boolean = false


final def isTraversableAgain : scala.Boolean = { /* compiled code */ }


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.iterator	//b: Iterator[Int] = non-empty iterator
b.toList	//List[Int] = List(1, 2, 3, 4)


override def last : A = { /* compiled code */ }


val a=Array(1,2,3,4)
a.last	//Int = 4


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,3,2,3,4)
a.lastIndexOf(3)	//Int = 3
a.lastIndexOf(3,2)	//Int = 1


def containsSlice[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,2,3,4)
val b=Array(2,3)
a.lastIndexOfSlice(b)	//Int = 3
a.lastIndexOfSlice(b,2)	//Int = 1


def lastIndexWhere(p : scala.Function1[A, scala.Boolean]) : scala.Int = { /* compiled code */ }
def lastIndexWhere(p : scala.Function1[A, scala.Boolean], end : scala.Int) : scala.Int


val a=Array(1,2,3,4)
a.lastIndexWhere(_>2)	//Int = 3
a.lastIndexWhere(_>2,2)	//Int = 2


def lastOption : scala.Option[A] = { /* compiled code */ }


val a=Array(1,2,3,4)
a.lastOption	//Option[Int] = Some(4)
val b:Array[Int]=Array()
b.lastOption	//Option[Int] = None


def length : scala.Int = { /* compiled code */ }


val a=Array(1,2,3,4)
a.length	//Int = 4


override def lengthCompare(len : scala.Int) : scala.Int = { /* compiled code */ }


val a=Array(1,2,3,4)
//就是拿前面数组的长度减去后面给的的参数值，得到的值就是返回值
a.lengthCompare(1)	//Int = 3
a.lengthCompare(4)	//Int = 0
a.lengthCompare(7)	//Int = -3


def lift: Int => Option[Int]


val a=Array(1,2,3,4)
a.lift(1)	//Option[Int] = Some(2)
a.lift(3)	//Option[Int] = Some(4)


def map[B, That](f : scala.Function1[A, B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.map(_*10)	//b: Array[Int] = Array(10, 20, 30, 40)


max[B >: A](implicit cmp : scala.Ordering[B]) : A = { /* compiled code */ }


val a=Array(1,2,3,4)
a.max	//Int = 4


def maxBy[B](f : scala.Function1[A, B])(implicit cmp : scala.Ordering[B]) : A = { /* compiled code */ }


val a=Array(1,2,3,4)
a.maxBy(_>2)	//Int = 3
a.maxBy(_>4)	//Int = 1


def min[B >: A](implicit cmp : scala.Ordering[B]) : A = { /* compiled code */ }


val a=Array(1,2,3,4)
a.min	//Int = 1


def minBy[B](f : scala.Function1[A, B])(implicit cmp : scala.Ordering[B]) : A = { /* compiled code */ }


val a=Array(1,2,3,4)
a.minBy(_<2)	//Int = 2
a.minBy(_<1)	//Int = 1


def mkString(start : scala.Predef.String, sep : scala.Predef.String, end : scala.Predef.String) : scala.Predef.String = { /* compiled code */ }


val a=Array(1,2,3,4)
a.mkString	//String = 1234
a.mkString("(",",",")")	//String = (1,2,3,4)


def nonEmpty : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=new Array[Int](0)
a.nonEmpty	//Boolean = true
b.nonEmpty	//Boolean = false


final def orElse[B >: A](alternative : => scala.Option[B]) : scala.Option[B] = { /* compiled code */ }


val b=Some("Hello Option")	//b: Some[String] = Some(Hello Option)
b.orElse(null)	//Option[String] = Some(Hello Option)
val b=None	//b: None.type = None
b.orElse(Some("Hello Scala"))	//Option[String] = Some(Hello Scala)


def padTo[B >: A, That](len : scala.Int, elem : B)(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
//填充一个长度为7的序列，不足位补8
val b=a.padTo(7,8)	//b: Array[Int] = Array(1, 2, 3, 4, 8, 8, 8)
//填充序列长度3,不足位补5，长度够的情况下不做操作
val c=a.padTo(3,5)	//c: Array[Int] = Array(1, 2, 3, 4)


override def par : scala.collection.parallel.mutable.ParArray[T] = { /* compiled code */ }


val a=Array(1,2,3,4,5)
a.foreach(print)	//12345
//多线程执行，是无序的
a.par.foreach(print)	//12543


def partition(p : scala.Function1[A, scala.Boolean]) : scala.Tuple2[Repr, Repr] = { /* compiled code */ }


val a=Array(1,2,3,4)
val b:(Array[Int],Array[Int])=a.partition(x=> x%2==0)	//b: (Array[Int], Array[Int]) = (Array(2, 4),Array(1, 3))
b._1	//Array[Int] = Array(2, 4)
b._2	//Array[Int] = Array(1, 3)


 def patch[B >: A, That](from : scala.Int, patch : scala.collection.GenSeq[B], replaced : scala.Int)(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(7,8,9)
val c=a.patch(1,b,2)	//c: Array[Int] = Array(1, 7, 8, 9, 4)


def permutations : scala.collection.Iterator[Repr] = { /* compiled code */ }


val a=Array("a","b","c")
val b=a.permutations	//b: Iterator[Array[String]] = non-empty iterator
b.toList	//List[Array[String]] = List(Array(a, b, c), Array(a, c, b), Array(b, a, c), Array(b, c, a), Array(c, a, b), Array(c, b, a))


def prefixLength(p : scala.Function1[A, scala.Boolean]) : scala.Int = { /* compiled code */ }


val a=Array(1,2,3,4)
a.prefixLength(_<3)	//Int = 2


def product[B >: A](implicit num : scala.Numeric[B]) : B = { /* compiled code */ }


val a=Array(1,2,3,4)
a.product	//Int = 24


def reduce[A1 >: A](op : scala.Function2[A1, A1, A1]) : A1 = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)
val b = a.reduce(seqno)
println("b = " + b)
}
/*
* seq_exp = 1 + 2
* seq_exp = 3 + 3
* seq_exp = 6 + 4
* b = 10
*/


override def reduceLeft[B >: A](op : scala.Function2[B, A, B]) : B = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)
val b = a.reduce(seqno)
println("b = " + b)
}
/*
* seq_exp = 1 + 2
* seq_exp = 3 + 3
* seq_exp = 6 + 4
* b = 10
*/


def reduceLeftOption[B >: A](op : scala.Function2[B, A, B]) : scala.Option[B] = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)
val b = a.reduceLeftOption(seqno)
println("b = " + b)
}

/*
* seq_exp = 1 + 2
* seq_exp = 3 + 3
* seq_exp = 6 + 4
* b = Some(10)
*/


def reduceOption[A1 >: A](op : scala.Function2[A1, A1, A1]) : scala.Option[A1] = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)
val b = a.reduceOption(seqno)
println("b = " + b)
}
/*
* seq_exp = 1 + 2
* seq_exp = 3 + 3
* seq_exp = 6 + 4
* b = Some(10)
*/


override def reduceRight[B >: A](op : scala.Function2[A, B, B]) : B = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)
val b = a.reduceRight(seqno)
println("b = " + b)
}
/*
* seq_exp = 3 + 4
* seq_exp = 2 + 7
* seq_exp = 1 + 9
* b = 10
*/


def reduceRightOption[B >: A](op : scala.Function2[A, B, B]) : scala.Option[B] = { /* compiled code */ }


def seqno(m: Int, n: Int): Int = {
val s = "seq_exp = %d + %d"
println(s.format(m, n))
m + n
}

def main(args: Array[String]) {
val a = Array(1, 2, 3, 4)
val b = a.reduceRightOption(seqno)
println("b = " + b)
}
/*
* seq_exp = 3 + 4
* seq_exp = 2 + 7
* seq_exp = 1 + 9
* b = 10
*/


def repr : Repr = { /* compiled code */ }


val a=Map(1->"a",2->"b")
a.repr	//scala.collection.immutable.Map[Int,String] = Map(1 -> a, 2 -> b)
val b=Array("java","scala")
b.repr	//Array[String] = Array(java, scala)


override def reverse : Repr = { /* compiled code */ }


val a=Array(1,2,3,4)
al b=a.reverse	//b: Array[Int] = Array(4, 3, 2, 1)


terator

override def reverseIterator : scala.collection.Iterator[A] = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.reverseIterator	//b: Iterator[Int] = non-empty iterator
b.toList	//List[Int] = List(4, 3, 2, 1)


def reverseMap[B, That](f : scala.Function1[A, B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


al a=Array(1,2,3,4)
val b=a.reverseMap(_*10)	//b: Array[Int] = Array(40, 30, 20, 10)


def runWith[U](action : scala.Function1[B, U]) : scala.Function1[A, scala.Boolean] = { /* compiled code */ }


 val pr:PartialFunction[Int,Int]={
case m:Int if m % 2==1 => m * 2
}
pr.runWith(println)(3)	//6	Boolean = true
pr.runWith(println)(2)	//Boolean = false


override def sameElements[B >: A](that : scala.collection.GenIterable[B]) : scala.Boolean = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(1,2,3,4)
a.sameElements(b)	//Boolean = true
val c=Array(1,3,2,4)
a.sameElements(c)	//Boolean = false
val d=Array(1,2,3,4,5)
a.sameElements(d)	//Boolean = false


def scan[B >: A, That](z : B)(op : scala.Function2[B, B, B])(implicit cbf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.scan(5)(_+_)	//b: Array[Int] = Array(5, 6, 8, 11, 15)


def scanLeft[B, That](z : B)(op : scala.Function2[B, A, B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.scanLeft(5)(_+_)	//b: Array[Int] = Array(5, 6, 8, 11, 15)


def scanRight[B, That](z : B)(op : scala.Function2[A, B, B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.scanRight(5)(_+_)	//b: Array[Int] = Array(15, 14, 12, 9, 5)


override def segmentLength(p : scala.Function1[A, scala.Boolean], from : scala.Int) : scala.Int = { /* compiled code */ }


val a=Array(1,2,3,1,1,1,4,1,2,3)
a.segmentLength(_<3,3)	//Int = 3


def seq : scala.collection.mutable.IndexedSeq[T] = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.seq	//b: scala.collection.mutable.IndexedSeq[Int] = WrappedArray(1, 2, 3, 4)


override def size : scala.Int = { /* compiled code */ }


val a=Array(1,2,3,4)
a.size	//Int = 4


override def slice(from : scala.Int, until : scala.Int) : Repr = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.slice(1,3)	//b: Array[Int] = Array(2, 3)


def sliding(size : scala.Int) : scala.collection.Iterator[Repr] = { /* compiled code */ }
def sliding(size : scala.Int, step : scala.Int) : scala.collection.Iterator[Repr] = { /* compiled code */ }


val a = Array(1, 2, 3, 4, 5)
val b = a.sliding(3).toList   //每次滑3步，步长为1
for (i <- 0 to b.length - 1) {
val s = "第 %d 组: %s"
println(s.format(i + 1, b(i).mkString(",")))
}
/*
* 第 1 组: 1,2,3
* 第 2 组: 2,3,4
* 第 3 组: 3,4,5
*/
val c = a.sliding(3, 2).toList   //每次滑3步，步长为2
for (i <- 0 to c.length - 1) {
val s = "第 %d 组: %s"
println(s.format(i + 1, c(i).mkString(",")))
}
/*
* 第 1 组: 1,2,3
* 第 2 组: 3,4,5
*/


def sortBy[B](f : scala.Function1[A, B])(implicit ord : scala.math.Ordering[B]) : Repr = { /* compiled code */ }


val a=Array(3,2,1,4)
//升序
val b=a.sortBy(x=>x)	//b: Array[Int] = Array(1, 2, 3, 4)
//降序
val b=a.sortBy(x=> -(x))	//b: Array[Int] = Array(4, 3, 2, 1)


def sortWith(lt: (A, A) => Boolean): Repr = sorted(Ordering fromLessThan lt)


def fun(m:Int,n:Int):Boolean={
m>n
}
val a=Array(1,2,3,3,2,3,3,4)
val b=a.sortWith(fun)	//b: Array[Int] = Array(4, 3, 3, 3, 3, 2, 2, 1)


def sorted[B >: A](implicit ord : scala.math.Ordering[B]) : Repr = { /* compiled code */ }


val a=Array(3,2,1,4)
val b=a.sorted	//b: Array[Int] = Array(1, 2, 3, 4)


override def span(p : scala.Function1[A, scala.Boolean]) : scala.Tuple2[Repr, Repr] = { /* compiled code */ }


val a=Array(1,2,3,4,1,2)
val b=a.span(_<3)	//b: (Array[Int], Array[Int]) = (Array(1, 2),Array(3, 4, 1, 2))


override def splitAt(n : scala.Int) : scala.Tuple2[Repr, Repr] = { /* compiled code */ }


val a=Array(5,6,7,8,9)
val b=a.splitAt(2)	//b: (Array[Int], Array[Int]) = (Array(5, 6),Array(7, 8, 9))


def startsWith[B](that : scala.collection.GenSeq[B]) : scala.Boolean = { /* compiled code */ }
def startsWith[B](that : scala.collection.GenSeq[B], offset : scala.Int) : scala.Boolean


val a=Array(1,2,3,4)
a.startsWith(b)	//Boolean = true
val c=Array(2,3)
a.startsWith(c,1)	//Boolean = true


def stringPrefix : scala.Predef.String = { /* compiled code */ }


val a=Array(1,2,3,4)
a.toString	//String = [I@38440546
a.stringPrefix	//String = [I


def sum[B >: A](implicit num : scala.Numeric[B]) : B = { /* compiled code */ }


val a=Array(1,2,3,4)
a.sum	//Int = 10


override def tail : Repr = { /* compiled code */ }


val a=Array(1,2,3,4)
a.tail	//Array[Int] = Array(2, 3, 4)


def tails : scala.collection.Iterator[Repr] = { /* compiled code */ }


val a = Array(1, 2, 3, 4)
val b = a.tails.toList
for (i <- 0 until b.length) {
val s = "第 %d 个值: %s"
println(s.format(i + 1, b(i).mkString(",")))
}
/*
* 第 1 个值: 1,2,3,4
* 第 2 个值: 2,3,4
* 第 3 个值: 3,4
* 第 4 个值: 4
* 第 5 个值:
*/


override def take(n : scala.Int) : Repr = { /* compiled code */ }


val a = Array(1, 2, 3, 4)
a.take(3)	//Array[Int] = Array(1, 2, 3)


 override def takeRight(n : scala.Int) : Repr = { /* compiled code */ }


val a = Array(1, 2, 3, 4)
a.takeRight(3)	//Array[Int] = Array(2, 3, 4)


 override def takeWhile(p : scala.Function1[A, scala.Boolean]) : Repr = { /* compiled code */ }


val b=Array(1,2,3,4,1,2)
a.takeWhile(_<3)	//Array[Int] = Array(1, 2)


override def to[Col[_]](implicit cbf: scala.collection.generic.CanBuildFrom[Nothing,Int,Col[Int]]): Col[Int]


val a = Array(1, 2, 3, 4)
a.to	//scala.collection.immutable.IndexedSeq[Int] = Vector(1, 2, 3, 4)


def toArray: Array[A]


def toBuffer[A1 >: A]: Buffer[A1]


def toIndexedSeq: collection.immutable.IndexedSeq[T]


def toIterable: collection.Iterable[T]


ef toList: List[T]


def toMap[T, U]: Map[T, U]


def toSet[B >: A]: Set[B]


def toStream: collection.immutable.Stream[T]


def toTraversable: Traversable[Int]


def toVector: Vector[T]


def transform(f: Int => Int): scala.collection.mutable.WrappedArray[Int]


val a = Array(1,2,3,4)
a.transform(x=>6)	//scala.collection.mutable.WrappedArray[Int] = WrappedArray(6, 6, 6, 6)


def transpose[U](implicit asArray : scala.Function1[T, scala.Array[U]]) : scala.Array[scala.Array[U]] = { /* compiled code */ }


val b=Array(Array("a","b"),Array("c","d"),Array("e","f"))
val c=b.transpose	//c: Array[Array[String]] = Array(Array(a, c, e), Array(b, d, f))


override def union[B >: A, That](that : scala.collection.GenSeq[B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val b=Array(1,2)
val c=Array(3,4)
val d=b.union(c)	//d: Array[Int] = Array(1, 2, 3, 4)


def unzip[T1, T2](implicit asPair : scala.Function1[T, scala.Tuple2[T1, T2]], ct1 : scala.reflect.ClassTag[T1], ct2 : scala.reflect.ClassTag[T2]) : scala.Tuple2[scala.Array[T1], scala.Array[T2]] = { /* compiled code */ }


val a=Array(("a","b"),("c","d"))
val b=a.unzip	//b: (Array[String], Array[String]) = (Array(a, c),Array(b, d))


def unzip3[T1, T2, T3](implicit asTriple : scala.Function1[T, scala.Tuple3[T1, T2, T3]], ct1 : scala.reflect.ClassTag[T1], ct2 : scala.reflect.ClassTag[T2], ct3 : scala.reflect.ClassTag[T3]) : scala.Tuple3[scala.Array[T1], scala.Array[T2], scala.Array[T3]] = { /* compiled code */ }


val a=Array(("a","b","x"),("c","d","y"),("e","f","z"))
val b=a.unzip3	//b: (Array[String], Array[String], Array[String]) = (Array(a, c, e),Array(b, d, f),Array(x, y, z))


def updated[B >: A, That](index : scala.Int, elem : B)(implicit bf : scala.collection.generic.CanBuildFrom[Repr, B, That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.updated(1,5)	//b: Array[Int] = Array(1, 5, 3, 4)


override def view : scala.AnyRef with scala.collection.mutable.IndexedSeqView[A, Repr] = { /* compiled code */ }
override def view(from : scala.Int, until : scala.Int) : scala.collection.mutable.IndexedSeqView[A, Repr] = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.view(1,3)	//b: scala.collection.mutable.IndexedSeqView[Int,Array[Int]] = SeqViewS(...)
b.mkString(",")	//String = 2,3


def withFilter(p : scala.Function1[A, scala.Boolean]) : scala.collection.generic.FilterMonadic[A, Repr] = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=a.withFilter(_>2).map(x=>x)	//b: Array[Int] = Array(3, 4)


override def zip[A1 >: A, B, That](that : scala.collection.GenIterable[B])(implicit bf : scala.collection.generic.CanBuildFrom[Repr, scala.Tuple2[A1, B], That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4)
val b=Array(4,3,2,1)
val c=a.zip(b)	//c: Array[(Int, Int)] = Array((1,4), (2,3), (3,2), (4,1))


def zipAll[B, A1 >: A, That](that : scala.collection.GenIterable[B], thisElem : A1, thatElem : B)(implicit bf : scala.collection.generic.CanBuildFrom[Repr, scala.Tuple2[A1, B], That]) : That = { /* compiled code */ }


val a=Array(1,2,3,4,5,6,7)
val b=Array(5,4,3,2,1)
val c=a.zipAll(b,8,9)	//c: Array[(Int, Int)] = Array((1,5), (2,4), (3,3), (4,2), (5,1), (6,9), (7,9))
val x=Array(1,2,3,4)
val y=Array(6,5,4,3,2,1)
val z=x.zipAll(y,8,9)	//z: Array[(Int, Int)] = Array((1,6), (2,5), (3,4), (4,3), (8,2), (8,1))


override def zipWithIndex[A1 >: A, That](implicit bf : scala.collection.generic.CanBuildFrom[Repr, scala.Tuple2[A1, scala.Int], That]) : That = { /* compiled code */ }


val a=Array('a','b','c','d')
val b=a.zipWithIndex	//b: Array[(Char, Int)] = Array((a,0), (b,1), (c,2), (d,3))


def subSequence(start : scala.Int, end : scala.Int) : java.lang.CharSequence = { /* compiled code */ }


val a=Array('a','b','c','d')
val b=a.subSequence(1,3)	//b: CharSequence = bc


03-12 243
04-29 972
02-07 507