scala-2.8 Questions
4
Solved
How to do that without creating any new collections? Is there something better than this?
val m = scala.collection.mutable.Map[String, Long]("1" -> 1, "2" -> 2, "3" -> 3, "4" -> 4)
m.f...
Gushy asked 23/3, 2010 at 14:12
19
Solved
For reading, there is the useful abstraction Source. How can I write lines to a text file?
3
Solved
In the Scala 2.8 collections framework, what is the difference between view and toStream?
4
Solved
@uncheckedVariance can be used to bridge the gap between Scala's declaration site variance annotations and Java's invariant generics.
scala> import java.util.Comparator
import java.util.Compar...
Outhe asked 16/3, 2010 at 12:33
3
Solved
I've seen several Scala questions recently (e.g. here, here, and here) that called for the use of proxies, and it's come up more than once in my own work. The Scala library has a number of proxy tr...
17
Solved
This is the same question for older version of Scala, but they say that Eclipse plugin has been improved vastly. Is it the best IDE now? How do different Scala IDE compare today?
6
Solved
How can I convert immutable.Map to mutable.Map in Scala so I can update the values in Map?
Patois asked 18/2, 2011 at 15:4
2
Solved
I'm totally new to Scala. Here I have tried to assign a empty array to a variable, it was successful. But when I tried to append an integer element to the variable an error occured as below:
var c...
5
Solved
Consider the following code:
class Foo(var name: String = "bar")
Now i try to get the value and the correct type of it via reflection:
val foo = new Foo
val field = foo.getClass.getDeclaredFiel...
Sanborne asked 17/4, 2010 at 10:39
7
Solved
I just finished Programming in Scala, and I've been looking into the changes between Scala 2.7 and 2.8. The one that seems to be the most important is the continuations plugin, but I don't understa...
Dermatosis asked 3/10, 2009 at 5:54
4
Solved
What are package objects, not so much the concept but their usage?
I've tried to get an example working and the only form I got to work was as follows:
package object investigations {
val Packag...
4
In many examples, it is described that you can use scala.io.Source to read a whole file like this:
val str = scala.io.Source.fromFile("test.txt").mkString()
But closing the underlying stream is ...
5
Solved
I have a Set in Scala (I can choose any implementation as I am creating the Set. The Java library I am using is expecting a java.util.Set[String].
Is the following the correct way to do this in Sc...
Mortification asked 10/2, 2010 at 0:32
6
Solved
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 the same in Scala.
Scala has ListMap and...
Woodrum asked 1/10, 2010 at 0:30
6
Solved
For example, there is a Scala array val A = Array("please", "help", "me"). How to choose a random element from this array?
4
Solved
I have a Seq containing objects of a class that looks like this:
class A (val key: Int, ...)
Now I want to convert this Seq to a Map, using the key value of each object as the key, and the objec...
Misbehavior asked 27/5, 2010 at 21:22
4
Solved
In Scala 2.8, there is an object in scala.collection.package.scala:
def breakOut[From, T, To](implicit b : CanBuildFrom[Nothing, T, To]) =
new CanBuildFrom[From, T, To] {
def apply(from: From) =...
Sidras asked 11/11, 2009 at 14:53
4
Solved
I wanted to ask if there is a list of annotations for Scala 2.8.0?
I stumbled upon @inline and @specialized but it would be nice if there is a complete list which also explains what they do exactly...
Renatorenaud asked 26/8, 2010 at 12:47
3
Solved
I have a Scala method that takes 2 parameters:
def test(x:Long,y:Int){}
On some occasion I need to pass null instead of long ... something like that:
test(null,x)
The result:
scala> test(n...
4
Solved
In 'Programming in Scala, Second Edition' at page 410 you can find class Simulation which have the following method:
private def next() {
(agenda: @unchecked) match {
case item :: rest =>
a...
Newsmagazine asked 26/12, 2011 at 18:33
2
Solved
OK, in the question about 'Class Variables as constants', I get the fact that the constants are not available until after the 'official' constructor has been run (i.e. until you have an instance). ...
3
Solved
My design incorporates a small database abstraction, whereby I implement each database as a Singleton (well, an object), with custom methods on the database for the couple of operations the code ca...
2
Solved
What does the following error message mean?
cannot override a concrete member
without a third member that's
overridden by both (this rule is
designed to prevent ``accidental
overrides'');
...
5
Solved
I don't know Java or Swing, but I'm quite familiar with Scala, and I have no problems using it for my purposes. But when I try to implement a GUI, I get a lot of problems/bugs that documentat...
Backwardation asked 23/12, 2010 at 0:44
3
Solved
I'm trying to integrate a Lift application into some existing Java code. In one of my snippets, I have an Array of Java objects that I need to map that into a NodeSeq. I can get an Array of Node's,...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.