摘要: if 表达式 Scala 的 if 如同许多其它语言中的一样工作。它测试一个状态并据其是否为真,执行两个分支中的一个: var filename = "default.txt" if (!args.isEmpty) filename = args(0) 由于 Scala 的 if 是能返回值的表达式 阅读全文
posted @ 2016-02-28 17:19 朱菜根 阅读(261) 评论(0) 推荐(0)
摘要: 一些基本类型 值类型 范围 Byte 8位有符号补码整数(-27~27-1) Short 16位有符号补码整数(-215~215-1) Int 32位有符号补码整数(-231~231-1) Long 64位有符号补码整数(-263~263-1) Char 16位无符号Unicode字符(0~216- 阅读全文
posted @ 2016-02-28 16:29 朱菜根 阅读(323) 评论(0) 推荐(0)
摘要: 类,字段和方法 类是对象的蓝图。一旦定义了类,就可以用关键字new从类的蓝图里创建对象,类的定义: class ChecksumAccumulator { // class definition goes here } 就能创建对象: scala> new ChecksumAccumulator r 阅读全文
posted @ 2016-01-24 14:08 朱菜根 阅读(430) 评论(0) 推荐(0)
摘要: Scala 简介 Scala 属于“可伸展语言”,源于它可以随使用者的需求而改变和成长。Scala 可以应用在很大范围的编程任务上,小到脚本大到建立系统均可以。 Scala 跑在标准 Java 平台上,可以与所有 Java 库实现无缝交互。它把面向对象和函数式编程理念加入到静态类型语言中。Scal... 阅读全文
posted @ 2016-01-09 19:41 朱菜根 阅读(378) 评论(0) 推荐(0)
摘要: 一、什么是 Spark Spark 是开源的类 Hadoop MapReduce 的通用的并行计算框架, Spark 基于 map reduce 算法实现的分布式计算,拥有 Hadoop MapReduce 所具有的优点;但不同于 MapReduce 的是 Job 中间输出和结果可以保存在内存中,... 阅读全文
posted @ 2016-01-03 00:30 朱菜根 阅读(354) 评论(0) 推荐(0)
摘要: 1.先要安装 JDK,下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 安装成功后在终端输入 java –version 可以看到版本信息即为安装成功:➜ ~ java... 阅读全文
posted @ 2016-01-02 23:06 朱菜根 阅读(408) 评论(0) 推荐(0)
摘要: 题目: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero. Note... 阅读全文
posted @ 2015-10-07 14:45 朱菜根 阅读(492) 评论(0) 推荐(0)
摘要: 题目: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoint... 阅读全文
posted @ 2015-10-06 13:53 朱菜根 阅读(414) 评论(0) 推荐(0)
摘要: 题目: Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding elemen... 阅读全文
posted @ 2015-10-05 19:08 朱菜根 阅读(197) 评论(0) 推荐(0)
摘要: 题目: Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longe... 阅读全文
posted @ 2015-10-04 16:11 朱菜根 阅读(1137) 评论(0) 推荐(0)