Skip to content

Scala – First Experience

February 12, 2015

Using Eclipse IDE and the details are as follows

Scala IDE build of Eclipse SDK
Build id: 3.0.4-2.11-20140723-2253-Typesafe

Scala Library – 2.11.2

A phenomenal change in the mindset.

The first learning is

  • def defines a method
  • val defines a fixed value (cannot be modified)
  • var defines a variable (can be modified)

Took sometime to understand.

How to read a file and move the contents to a list? (“\n” being the line separator)

val fileContentsList= io.Source.fromFile(“h:/SampleTripFile.txt”).getLines.toList

main method is also there

def main(args: Array[String]) {

Used Casbah (Scala toolkit for MongoDB).

Yes, good learning and enjoying the constructs and the simplicity.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: