Permalink
Browse files

comments and removal of old stuff

  • Loading branch information...
1 parent e4b9620 commit e260aedf0ea353cc0fbdd01983c226849ce80459 @anderseriksson committed May 15, 2012
View
1 src/main/java/com/jayway/nojavacannot/RangeFinder.java
@@ -5,6 +5,7 @@
/**
* Created by Anders Eriksson.
+ * TODO demo a call from Scala to Java code. (No need for Maven project, this can be done with sbt)
*/
public class RangeFinder {
View
14 src/main/scala/CaseClasses.scala
@@ -1,7 +1,7 @@
object CaseClasses {
/**
- * Key benefits of named params: Short. Flexible. Useful toString
+ * Key benefits of named params: Short. Flexible. Useful toString. Copy method.
* TODO: What are the characteristics of case class
* References future improvements http://docs.scala-lang.org/sips/completed/named-and-default-arguments.html
*/
@@ -25,4 +25,16 @@ object CaseClasses {
// scala> Apartment(4)
// res2: CaseClasses.Apartment = Apartment(4,false,false)
+// scala> res2.copy(hasWasher = true)
+// res5: CaseClasses.Apartment = Apartment(4,false,true)
+
+
+ def categorize(apartment: Apartment): String = {
+ apartment match {
+ case Apartment(1, _ , _ ) => "Etta"
+ case Apartment(x, true , _ ) => "Balcony with " + x + " rooms!"
+ case Apartment(_, _ , true ) => "Anything with a washer!"
+ case _ => "Unknown apartment"
+ }
+ }
}
View
2 src/main/scala/Family.scala
@@ -6,7 +6,7 @@
* implementation) then extractors are nice! See discussion PIS2E chapter 26.6
* Other examples http://booksites.artima.com/programming_in_scala_2ed/examples/html/ch26.html
*/
-
+@deprecated
object Family {
def apply(familyMember: FamilyMember*): List[FamilyMember] = {
View
2 src/main/scala/Rational.scala
@@ -1,4 +1,6 @@
/**
+ * Demonstration of DSL and operators being methods.
+ *
* Example from Programming in Scala 2nd edition
* http://booksites.artima.com/programming_in_scala_2ed/examples/html/ch06.html
*
View
25 src/main/scala/ReplDemo.scala
@@ -0,0 +1,25 @@
+/**
+ * Created by Anders Eriksson.
+ */
+
+object ReplDemo {
+
+
+
+// 684 :sh find .. -name *.scala
+// 685 res0.lines
+// 686 res1.lines
+// 687 res2.lines
+// 688 res2.lines.head
+// 689 res2.lines.head.split('/')
+// 690 res2.lines.head.split('/').end
+// 691 res2.lines.head.split('/').head
+// 692 res2.lines.head.split('/').tail
+// 693 res2.lines.head.split('/').length
+// 694 res2.lines.head.split('/').toList
+// 695 res2.lines.head.split('/').toList.last
+// 696 res2.lines.map( split('/').toList.last )
+// 697 res2.lines.map( line => line.split('/').toList.last )
+
+
+}
View
4 src/main/scala/RockScissorsPaper.scala
@@ -4,10 +4,10 @@
* Created by Anders Eriksson.
* http://en.wikipedia.org/wiki/Rock-paper-scissors
*
- * Should try to find a better exampel with input that sometimes is
+ * Should try to find a better example with input that sometimes is
* ignorable (thus using _ ) and
*/
-
+@deprecated
class RockScissorsPaper {
def play(a: String, b: String): String = {
View
11 src/main/scala/com/jayway/example/Test.scala
@@ -1,11 +0,0 @@
-package com.jayway.example
-
-object CalcExample {
- def add(x:Int, y:Int) : Int = x + y
-}
-
-//TODO remove later on...
-case class CaseClassExample(a: Int = 1, b: Int = 3);
-
-
-

0 comments on commit e260aed

Please sign in to comment.