Questions tagged [mutablemap]

40 questions
0
votes
1 answer

how to add element to immutable array and return that map

def jdbcReader(user: String, pwd: String, url: String, id: Int): List[mutable.Map[String, String] = { var KeyVal = mutable.Map[String, String]() var connection: Connection = null try { connection = DriverManager.getConnection(url,…
testkir
  • 1
  • 1
0
votes
1 answer

Guava Graph library ElementOrder on Edges instead of Nodes

I have this straight-forward Graph structure using the Guava Graph library and I'd like to understand better if that is possible to sort the adjacents/edges (not the node order). For the sake of clarification: import…
Fernando Barbeiro
  • 762
  • 4
  • 15
  • 33
0
votes
1 answer

Kotlin: Why does val b (Map) change over the iteration even though actions occur over another var a in do-while loop?

Why does such code only occur in one iteration? Why does "b" change simultaneously with "a" after assignment before the end of the iteration? I made a similar code where (a) and (b) are integers, then (b) does not change until the next iteration.…
0
votes
0 answers

Kotlin and swift full map navigation speed

I'm trying to understand what is the best way to navigate maps in kotlin (and swift), when you need to navigate the whole map. Both languages offer a .values method that make the navigation simpler, but with a C++ background I thought it could not…
gabry
  • 1,370
  • 11
  • 26
0
votes
1 answer

Complex MutableMap type

I'm getting a little confused here. So, I have a mutableMap of type val converters = mutableMapOf, x>>() where I can't figure out x I need to add to this map several pairs based on a constructor and a method, such…
elect
  • 6,765
  • 10
  • 53
  • 119
0
votes
1 answer

How to update every value of the keyset in a LinkedHashMap in Scala, having a LinkedHashMap[Int, ListBuffer[Int]]?

I have a LinkedHashMap of type: var map: LinkedHashMap[Int, ListBuffer[Int]] = ((1 -> (2, 1)), (2 -> 2), (3 -> (5, 3))) I want to add an element to every list of every key, let's say i want to add "6" in order to have: ((1 -> (6, 2, 1)), (2 -> (6,…
Andrea
  • 47
  • 7
0
votes
1 answer

Convert case class containing objects containing mutableMap to json and back using lift

I have a case class as : case class Cart(cart_id :UUID, cart_entries :Map[String,CartEntry]){ //override def toString: String = "Saini CartId = " + cart_id.toString } I am using net.liftweb.json._ to convert this into json : implicit val…
nitin_sh
  • 83
  • 1
  • 9
0
votes
1 answer

Heap Space with mutable.HashMap

I'm generating a HashMap where I can estimate the requiered size, for factorials: import scala.collection.mutable.HashMap val mm = new HashMap [Int, BigInt] mm.put (0, 1) def fak (i: Int) : BigInt = mm.getOrElseUpdate (i, i * fak…
user unknown
  • 35,537
  • 11
  • 75
  • 121
-1
votes
1 answer

KMM: casting Kotlin's MutableMap to Swift

I was able to retrieve a binding Swift Array from a Kotlin MutableList source,but I can’t find the way to retrieve a binding Swift Array from a Kotlin MutableMap of MutableLists source, given the map key. ===== Kotlin MutableList to binding Swift…
Daniele B
  • 19,801
  • 29
  • 115
  • 173
-1
votes
1 answer

Newbie Kotlin on Android MutableMap initialisation question

Stripped down to the bare essence, my problem is: class MainActivity : AppCompatActivity() { lateinit var testArray: Array lateinit var testMap: MutableMap>> override fun onCreate(savedInstanceState:…
Taqras
  • 173
  • 1
  • 10
1 2
3