scala-collections
Implement a scala collection so that map, filter, etc. produce the right type
I\'m trying to implement a default valued map, and I\'d like filters, maps, etc. over a DefaultingMap to also produce a DefaultingMap whenever possible. Here\'s my initial implementation:[详细]
2023-01-26 02:37 分类:问答Scala foldLeft on Maps
How do you use Map.foldLeft?According to the docs it looks like foldLeft [B] (z: B)(op: (B, (A, B)) ⇒ B) : B[详细]
2023-01-25 15:07 分类:问答Catching an exception within a map
What is the be开发者_StackOverflow中文版st way of handling exceptions while iterating over a loop in Scala?[详细]
2023-01-23 22:05 分类:问答How to write a zipWith method that returns the same type of collection as those passed to it?
I have reached this far: implicit def collecti开发者_StackOverflow中文版onExtras[A](xs: Iterable[A]) = new {[详细]
2023-01-19 03:17 分类:问答New to 2.8 collections. What would this signature look like? Similar to scalaz sequence
I found a blog post today that mention\'s scalaz\'s sequence function. Couldn\'t you do something as simple as:[详细]
2023-01-19 01:03 分类:问答Scala for-comprehension returning an ordered map
How can I use a for-comprehension that returns something I can assign to an ordered Map? This is a simplification of the code I have:[详细]
2023-01-18 17:03 分类:问答Scala Map implementation keeping entries in insertion order?
In Java, I use LinkedHashMap for this purpose. The documentation of Java\'s LinkedHashMap is very clear that it has \"predictable iteration order\" and I need th开发者_JS百科e same in Scala.[详细]
2023-01-18 12:53 分类:问答scala 2.8 collections inconsistency?
why the methods transform (in-place mutation version of map) and retain (in-place mutation version of filter) are defined on only开发者_C百科 mutable.Map but not on mutable.Buffer and mutable.Set? sho[详细]
2023-01-16 14:18 分类:问答iterating over Scala collections in Java
How I can iterate over Scala collections in Jav开发者_JS百科a?Some example Scala class AThing { @scala.reflect.BeanProperty val aList = List(1,2,3,4,99)[详细]
2023-01-15 11:18 分类:问答What is the most succinct Scala way to reverse a Map?
What is the most succinct Scala way to reverse a Map? The Map may contain non-unique values. EDIT: The reversal ofMap[A, B] should give Map[B, Set[A]] (or 开发者_开发问答a MultiMap, that would be ev[详细]
2023-01-15 06:28 分类:问答