Scala

Gatling DSL methods - substring available?

I want to use the function substring with Gatling EL notation ${attributeName} syntax. I am trying to do "${attributeName.substring(0,5)}". It …

Java

How to access individual value of a map in a Map[String,(String, String)]

How can i access the individual values in a Map, so to say. the Map is of type Map[String,(String, String)]. Based on the input string i want to …

Java

Scala's apply method

I am constructing a List in Scala as below:Val list1 = List(1,2,3) //This is otherwise: List.apply(1,2,3) ---> ANow I have the below line.list1(1) …

Java

Checking if values in Map is part of String

I am looking for the exact same thing as in here except for one difference : Checking if values in List is part of String,but in my case keys is a …

Java

Scala: How to create one jar or fat jar with SBT? (Java class not found in Scala)

I would like to use some private/external packages in Scala but when I generated the JAR file (sbt package) I don't have these packages. In others …

Java

Request Content-Length 265529745 exceeds the configured limit of 31457280

I am trying the streaming example of snappydata from url https://github.com/SnappyDataInc/snappy-pocWhen I submit the job using …

Scala

Mocking time for Scala Deadline during unit testing

Java 8's time API allows mocking by passing in a custom clock in Instant.now(clock) invocations. Similarly, LocalDateTime.now(clock).I have a …

Unit Testing

Scala, can I pass a class constructor parameter (not defined as implicit) as an implicit value?

I'm new to Scala so bear with me.If I try this in the console (or IDE) I get the following error.Within the context of the method thisWontCompile can …

Java

Scala case class, modify a parameter in constructor

I have a case classLocale can be "en-GB" or "en_GB" . So I want to replace the hyphen by underscore.The idea is to transform , so there is this …

Scala

scala convert Array[Product] to Array[MyType]

I have my own class:In other class I haveSo I try to update my array like this:But result of this func is <b>Array[Product with Serializable]</b>, so I need</b> …

Scala

Type mismatch when using Scala case class constructor as a method call

Working on a custom XML format parser, I have implemented a simple case class:In another call, I construct objects of that class like this:This works …

Stack Overflow

Boolean logic in lambda calculus in Scala

I am trying to implement basic Boolean logic in lambda calculus in Scala, but I am stuck at the beginning.I have two types:And 'false', that works …

Calculus

SBT's scala dependencies reports logic

I'm trying to figure out the logic of dependencies' XML reports produced by SBT for scala projects. I want to get a full dependency tree of my …

Java

Reading password from console in Scala

In a Scala program I need to read from the standard input a password string (with echoing disabled). I tried with:But for some reason I cannot invoke …

Disability

Why element order is not preserved when converting a list of pairs to Map in Scala?

Example:returns Map(x -> 1, n -> 1, u -> 2, l -> 2, r -> 1) Elements are no longer sorted with alphabet order.Wander why this happens?

Scala

For each key get only a number of values

Let's say I have a Product object with the following attributes:I want to write a job which takes only 3 products for each ClientId.Can I achieve …

Scala

Not source found scala - Maven project

I have created a scala maven project, I wrote a simple programme scala then I did RunAs -> Maven install, it return Build success, but it dispaly …

Java

Scala Jackson Unmarshalling - Conflicting setter definitions for property "config": com.fasterxml.jackson.databind.ObjectMapper#setConfig(1 params) vs

I have a small Scala program to unmarshall JSON but getting the error: "com.fasterxml.jackson.databind.JsonMappingException: Conflicting setter …

Java

clean way to handle future of option in scala func

I have some simple enum name Result of fail/successand I have a function that get nothing and returns Future of Result,I dont like my solution, it …

Schadenfreude

download scowl in Lunix using command line

I have to manipulate my OWL file with Scala language. therefore, I found that scowl: https://github.com/phenoscape/scowl facilitates this task. I'm …

Command-line

How to use scala reflection to determine associate an object with a field name

I'd like to use reflection to provide debug output from my program. The invariant I have is that each object has an associated parent.Then I want to …

JavaScript

scala generic method less boilerplate

How can I prevent some code repetition for a generic method in scala? My code only compiled when the type parameter was bound to the trait and not …

Java

Scala - Injecting Generic type using guice when dependency class is also using same generic type

I want to inject dependency with Generic type using Guice. Find below example in scala which replicate the …

Scala

scala match on iteration, weird compiler error

This small piece of scala code when compiled it gives a strange error.Gives the following error:Any hints?

Java

How to get error message from the scala/java MongoDB api

I'm using Casbah (mongodb scala library). I have an insert that doesn't work.If I change this for something simpler (like, a simple {"hello": …

Databases

How to carry out fileupload in play(Scala)

I am trying to write a simple file upload application, that would upload a file to a server, but when I run the code, a get a type mismatch error. I …

Scala

Complete akka-http response with an iterator

I have an iterator of mongodb query results and I want to stream those results to http response without loading the whole results set into memory.Is …

Java

Extracting numbers in 9+.9* format from text with Scala regex

I want to match decimals with integer parts but with or without decimal parts, e.g. 1.1, 0.1, 1. but not .1 in Scala.Currently, my solution …

Scala

Catching dangling or unused Futures in Scala

A common problem in our Scala code is that a call that returns a Future[T] will not be awaited (we commonly use the scala-async library because many …

Scala

Implementing Isolation Forest in Spark Scala

I am trying to implement Isolation Forests algorithm using Spark Scala Maven project. It is explained on this link: iforest example.My question is: …

Big Data