Skip to main content

All Questions

1 vote
2 answers
338 views

How to change keys from a map in scala

How to change the following keys from the map without any variables full functional HashMap(false -> List(20, 15, 20, 17), true -> List(50, 25, 45, 21, 100, 2000, 2100)) to HashMap("...
Max Hager's user avatar
0 votes
0 answers
52 views

How to rotate a 90-degree asymmetric matrix using Scala recursion [duplicate]

I'm writing a simple anomaly detector for time-series data in Scala. I need to rotate a matrix by 90 degrees or find a better way to have a map[String,Vector[Double] that holds the data. I get the ...
Yarin Meron's user avatar
0 votes
2 answers
225 views

How to unwind an object based on deeply nested list fields in scala?

Simplified Scenario Lets take a simplified example with 2 levels of nested fields in a case class. Suppose I have a case class Person as shown below: case class Address( name: String, zipCodes: ...
oblivion's user avatar
  • 6,578
1 vote
1 answer
552 views

Play framework: Why does https url not work on using "sbt dist" command?

I am trying to create executable file for deploying my web app using play framework sbt dist command. When I run my application using "sbt run" command then https work but when I use sbt dist and run ...
Shashi Shekhar's user avatar
-2 votes
2 answers
135 views

How to use val instead of var in scala

I simply want to remove var and use Val instead in below code def getConfigId: Long = { val object1: java.util.List[objectA] = objectRepo.findByUser(User(session.id)) var object2: objectA = null if (...
lets code's user avatar
  • 143
3 votes
0 answers
6k views

How to perform a `Collectors.toList()` correspondingly in scala

I have the following class and method used in the code below with ids being a Set[String]: case class PAV () def aggregate(pId: String, iId: Option[String], count: Int): PAV I have tried the ...
Naman's user avatar
  • 32.2k
2 votes
2 answers
2k views

What's the best way to retrieve the value in a nullable Optional?

Suppose you have an Optional<T> variable that could take on one of 3 values: the value T an Optional with a null T in it the variable is null itself What's the best way to retrieve the value T ...
kane's user avatar
  • 6,037
4 votes
3 answers
4k views

Functional Programming vs OOP [closed]

I just looked up a few examples/definitions of the differences between Functional Programming and OOP. I found one definition that I thought was interesting and I understood the OOP part but needed a ...
sgx's user avatar
  • 1,327
0 votes
1 answer
15k views

Scala compile time error: No implicits found for parameter evidence$2: BodyWritable[Map[String, Object]]

I am working on scala play framework application. I am trying to call a web service API which takes request payload data as follows { "toID": [ "[email protected]", "email2@email....
Shashi Shekhar's user avatar
0 votes
1 answer
473 views

How to pass optional parameters while accessing web service API in play framework?

I am new to play framework and trying to integrate a microservice. I am using WSClient to call a web service. In order to call a POST rest API, I am passing request body which contains some required ...
Shashi Shekhar's user avatar
2 votes
1 answer
212 views

How to export Scala Transformation to Java

I'm trying to implement a Scala trait by Java, the trait has a generic container type within another container, which couldn't be solved automatically by java import, the Scala code is below: import ...
user3593261's user avatar
1 vote
1 answer
557 views

Scala Fold Left with Two Parameter Types

How can I convert this basic function func2 into a fold left in Scala? Here is the iterative approach. I use two functions. def func1(list1: List[foo], item: bar): List[foo] = { does something ...
George Orwell's user avatar
-3 votes
1 answer
93 views

Functional Data structures to support flow control

I'd like to find a functional data structure that can perform "Flow control". Example: For any IP visiting my website, if the IP has visited >= N times since M minutes ago, the IP is restricted to ...
Czyhandsome's user avatar
1 vote
4 answers
3k views

scala class members causing error "Class 'class' must either be declared abstract or implement member 'member' "

I am trying to learn Scala Objects and Class. I come from Java which is quite similar to Scala, but not in syntax. In Java, I would create a class like: public class Wallet { private PublicKey ...
CybeX's user avatar
  • 2,436
4 votes
1 answer
636 views

scala count strings in a list contained in a read file

I am new to SO but have spent days going through related to questions. The closest related question I found is How to compare each word of a line in a file with a list element in scala? but that goes ...
Amy Makenzie's user avatar

15 30 50 per page
1
2 3 4 5 6