Linked Questions

146 votes
9 answers
11k views

I'm writing an explanation for some code for a course, and have been accidentally using the words method and function interchangeably. I decided to go back over and fix the wording, but ran into a ...
Carcigenicate's user avatar
8 votes
3 answers
856 views

Coming from Java I am confused by the class/object distinction of scala. Note that I do not ask for the formal difference; there are enough references on the web which explain this, and there are ...
John's user avatar
  • 97
2 votes
2 answers
2k views

I'm very new to scala and now I have to work on a project which is written both in scala and java. I came across with this-like construction: class SomeType{ //... } trait Trait1 extends scala....
St.Antario's user avatar
  • 27.7k
5 votes
5 answers
908 views

From an example in book "Begining in Scala", the script is: import scala.collection.mutable.Map object ChecksumAccumulator { private val cache=Map[String,Int]() def calculate(s: String):Int = ...
william luo's user avatar
5 votes
2 answers
5k views

I am newbie to scala . I am trying to create an Object that extends abstract class like show below object Conversions extends UnitConversions { override def inchesToCentimeters(inches:Int) = inches *...
user3619698's user avatar
5 votes
1 answer
5k views

trait MyFunctionTrait extends ((Int, Int) => Double) class MyFunction1 extends MyFunctionTrait { override def apply(a: Int, b: Int) => Double = a/b } object MyFunction2 extends ...
Make42's user avatar
  • 13.3k
-2 votes
2 answers
935 views

I have started learning Scala.Is there any difference between an object in Java versus an object in Scala. As per my understanding the object created in Scala is singleton. Any other pointers please.
Avinash Reddy's user avatar
1 vote
2 answers
734 views

Suppose I have two descendants of an abstract class: object Child1 extends MyAbstrClass { ... } class Child2 extends MyAbstrClass { } Now I'd like to determine (preferably in the constructor of ...
Petr's user avatar
  • 63.6k
0 votes
3 answers
195 views

I just learned Scala. When I read official documentation to look up Array, for example, it has two versions. One is for Class, the other is for Object. I think I know the difference between Class and ...
CSnerd's user avatar
  • 2,259
1 vote
1 answer
437 views

I am trying to learn Scala and it seems like a very powerful language so far, but some things seem hard to achieve, may be its just my learning curve. I have researched online for a few days but could ...
ajaymysore's user avatar
2 votes
1 answer
573 views

I got not serializable error when running this code: import org.apache.spark.{SparkContext, SparkConf} import scala.collection.mutable.ArrayBuffer object Task1 { def findHighestRatingUsers(...
Leming Qiu's user avatar
0 votes
2 answers
118 views

I have started learning about Play, and in the tutorials that I saw, the model usually has two components: a case class and an object. I have created a model with an object and a case class. My ...
bsky's user avatar
  • 20.5k
3 votes
1 answer
249 views

I'm reading the MEAP of the second edition of "Functional Programming in Scala" and I ran across the following in a listing: In Parsers.scala: trait Parsers[Parser[+_]]: ... extension [A]...
melston's user avatar
  • 2,374
0 votes
2 answers
170 views

I don't understand why sometimes class are created inside an object in Scala, just like the following code shows. object polynomials { class Poly(terms0: Map[Int, Double]) { val terms = terms0 ...
Hillary 's user avatar
0 votes
1 answer
325 views

I've been trying, for some time now, to create a local process that will act as a CLI for my server. The idea is similar to what Drush does for Drupal servers. I haven't created the CLI interface yet ...
Eyal's user avatar
  • 798

15 30 50 per page