scala-collections
Create an immutable list from a java.lang.Iterator
I\'m using a library (JXPath) to query a graph of beans in order to extract matching elements. However, JXPath returns groups of matching elements as an instance of java.lang.Iterator and I\'drather l[详细]
2023-03-06 16:24 分类:问答Concatenating sets contained within a set of objects, functionally in scala
I\'m just beginning in scala and I\'m converting some java code into scala and trying to make it nice and functionally elegant.[详细]
2023-03-05 10:35 分类:问答How can I override Iterable.flatMap in Scala 2.9.0?
I\'m just updating some of my code to 2.9.0, and I\'ve run into a problem. I have a trait that I call \"NonStrictIterable\" (essentially, everything should be as lazy as possible --- no code outside N[详细]
2023-03-05 07:05 分类:问答Scala method to combine each element of an iterable with each element of another?
If I have this: val a = Array(\"a \",\"b \",\"c \") val b = Array(\"x\",\"y\") I 开发者_运维知识库would like to know if such a method exists which would let me traverse the first collection, and fo[详细]
2023-03-04 18:51 分类:问答How to get the proper return type when using a filter based on type in Scala
The following doesn\'t compile. Do I need to cast the person first? object People { def all = List( new Person(\"Jack\", 33),[详细]
2023-03-04 18:04 分类:问答How to subclass Scala immutable.Map with fixed type parameters?
I can\'t figure out how to deal with overriding \"+\" in an immutable map if the map can only store an invariant type for its values.[详细]
2023-03-03 10:38 分类:问答How to implement Map with default operation in Scala
class DefaultListMap[A, B <: List[B]] extends HashMap[A, B] { override def default(key: A) = List[B]()[详细]
2023-03-02 02:21 分类:问答How do I convert an Array[String] to a Set[String]?
I have an array of strings. What\'s the best way to turn it into an immutable set of strings? I presume this is a single method call, but I can\'t find it in the scala docs.[详细]
2023-02-28 07:46 分类:问答Use cases of Scala collection forwarders and proxies
Scala\'s collection library contains the forwarders IterableForwarder, TraversableForwarder, SeqForwarder and proxies like IterableProxy, MapProxy, SeqProxy, SetProxy, TraversableProxy, etc. Forwarder[详细]
2023-02-27 05:12 分类:问答Should Scala's map() behave differently when mapping to the same type?
In the Scala Collections framework, I think there are some behaviors that are counterintuitive when using map().[详细]
2023-02-24 22:22 分类:问答