learning scala read from file
scala读文件:
example:
scala> import scala.io.Source
import scala.io.Source
scala> var inputFile = Source.fromFile("text.txt")
inputFile: scala.io.BufferedSource = non-empty iterator
scala> for ( line <- inputFile.getLines()) println(line)
hello panzidong
spark is good
scala> inputFile.close()
learning scala read from file的更多相关文章
- learning scala write to file
scala 写文件功能: scala> import java.io.PrintWriterimport java.io.PrintWriter scala> val outputFile ...
- learning scala 数组和容器
数组:可变的,可索引的,元素具有相同类型的数据集合 一维数组 scala> val intValueArr = new Array[Int](3)intValueArr: Array[Int] ...
- learning scala control statement
1 .if satement 与其它语言不同的是,scala if statement 返回的是一个值 scala> val a = if ( 6 > 0 ) 1 else -1a: In ...
- learning scala output to console
控制台输出语句: print println example: scala> print("i=");print(i)i=345scala> println(" ...
- learning scala read from console
控制台输入语句: readInt, readDouble, readByte, readShort, readLong, readChar, readBoolean, readLine example ...
- learning scala 变量
scala 变量: val : 声明时,必须被初始化,不能再重新赋值. scala> test = "only1"<console>:11: error: not ...
- learning scala 操作符
scala 操作符: 算术运算符: + - * / % 关系统运算符: > , < ,= ,!= ,>=,<=, 逻辑运算符: && . || , ! 位 ...
- learning scala akka ask_pattern
package com.example import akka.actor._ import akka.util.Timeout object Tutorial_03_Ask_Pattern exte ...
- learning scala akka actorySystem create and close
package com.example import akka.actor.ActorSystem import scala.util.{Failure, Success} import scala. ...
随机推荐
- leecode第一百四十二题(环形链表II)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode ...
- newborn, infant, toddler以及baby的区别
1.An infant (from the Latin word infans, meaning "unable to speak" or "speechless&quo ...
- x1c 2018 静音调教
折腾快1周,在去intel官网手动下载最新显卡驱动,手动卸载老驱动,断网,重启,手动安装之后(还要再禁用点和散热相关的设备).终于不卡了.开始工作,但又遇到一个问题:太TM吵了! 经过调教,基本保障看 ...
- yum的配置文件介绍
yum 的配置文件分为两部分:main 和repository main 部分定义了全局配置选项,整个yum 配置文件应该只有一个main.常位于/etc/yum.conf 中. reposito ...
- AtCoder Regular Contest 103 E Tr/ee
Tr/ee 思路:按照下图所示连接 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #inclu ...
- ionic 搜索双向数据绑定失效
1.用data对象存储变化的数据 js: $scope.data={}; $scope.data.keywords = ""; $scope.search = function() ...
- 动态规划-Race Car
2018-10-26 21:06:54 问题描述: 问题求解: 方法一.BFS 首先将使用BFS进行解空间的遍历,也就是将本问题转化成了搜索问题,但是有两个地方需要注意: 1.状态保存的问题,每个位置 ...
- Java Config for WebProject
1.Java EE vs Java SE They are just official SDK,when using IDE,it's ok to just install jdk/jre. &quo ...
- 用C#实现多种方式播放Wav声音
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 用where导致group by分组字段的索引失效
把两个单独的索引合并成一个组合索引,即把where条件字段的索引和group by的分组字段索引组合成一个. 如果分组的字段需要用函数处理,可以用索引函数 Generated Column(函数索引) ...