DT Big Data Dream Factory 5th Talk

Source: Internet
Author: User

DT Big Data Dream Factory 5th lecture http://yun.baidu.com/s/1jGjFpWy This section Wang teacher spoke the array. The main thing is to use the Scala worksheet feature. This function can print out the operation of each line of code. Package Com.dt.scala.hello

Import Scala.collection.mutable.ArrayBuffer

Object Arrayops {

  def main (args:array[string]): Unit = {    val nums = new Array[int] (Ten)     val a = New Array[string] (Ten)     val s = Array ("Hello", "World")     s (0) = "Goodbye"            val b = Arraybuffer[int] ()     B + = 1     B + = (1, 2, 3, 5)     b ++= Array (8,, 2)     b.trimend (5)     B.insert (6,) &NBSP;&N bsp;  B.insert (2, 7, 8, 9)     B.remove (2)     B.remove (2, 3)     B.toa Rray         for (i <-0 until a.length)      println (i + ":" + A (i) )               val c = Array (2, 3, 5, 7, one)     Val Res Ult = for (elem <-c) Yield 2 * elem     for (elem <-c if elem% 2 = = 0) Yield 2 * elem      C.filter (_% 2 = =0). Map (2 * _)         Array (1, 7, 2, 9). Sum     ArrayBuffer ("Mary", "had", "a "," little "," Lamb "). Max         val d = ArrayBuffer (1, 7, 2, 9)     Val bsor Ted = d.sorted         val e = Array (1, 7, 2, 9)     Scala.util.Sorting.quick Sort (e)         e.mkstring ("and")     a.mkstring ("<", ",", ">") & nbsp;       val matrix = array.ofdim[double] (3, 4)     Matrix (2) (1) = &NBSP;&N bsp;  val triangle = new Array[array[int] (Ten)      for (i <-0 until triangle.length)  & nbsp;   triangle (i) = new Array[int] (i + 1)          }

}

DT Big Data Dream Factory 5th Talk

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.