What do you want to save?
Add Code snippet
New code examples in category Scala
-
Ragavan 2021-10-24 15:39:09
scala add to list
def::[B >: A](elem: B): List[B] Adds an element at the beginning of this list. elem is the element to prepend. returns a list which contains x as first element and which continues with this list. Example: 1 :: List(2, 3) = List(2, 3).::(1) = Lis... Add solution -
Alan Tree 2021-10-23 11:40:13
scala Error: Main method not found in class please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application
/* This happened to me because an the object that extended App had the same name of a test class. Try renaming the object or the class if this could be your case too. */ Add solution -
Ghanem 2021-10-22 18:48:18
scala generic function
def listOfDuplicates[A](x: A, length: Int): List[A] = { if (length < 1) Nil else x :: listOfDuplicates(x, length - 1) } println(listOfDuplicates[Int](3, 4)) // List(3, 3, 3, 3) println(listOfDuplicates("La", 8)) // List(La, La, ... Add solution -