The API doc says that the parameter of Map.make is Type but this didn't help...
-- Cedric
cbeustWed 25 Jun 2008
Ok, figured it out ten seconds after I posted this:
map := [Int:Int][:]
I'm still curious to hear why my various make() attempts failed...
heliumWed 25 Jun 2008
Try
map := Map.make([Int:Int].type)
tompalmerWed 25 Jun 2008
I think this parameter is like the array instance passed into List#toArray in Java. Is that correct?
andyWed 25 Jun 2008
You don't need the first set of square brackets:
map := Int:Int[:]
Maps and Lists should rarely ever be created using the make() methods, unless you're doing so reflectively. But if you need to use Map.make (as helium noted) you need to pass in a Map Type.
cbeust Wed 25 Jun 2008
Another silly question, but I can't find any mention of it in the doc nor in the Fan sources: how do I create an empty map?
I tried
map := Map.make([Int:Int]) map := Map.make(Int:Int) map := Map.make(int, int) map := Map.make(Type.make(int, int))
and quite a few other combinations, but no luck.
The API doc says that the parameter of Map.make is Type but this didn't help...
-- Cedric
cbeust Wed 25 Jun 2008
Ok, figured it out ten seconds after I posted this:
I'm still curious to hear why my various make() attempts failed...
helium Wed 25 Jun 2008
Try
tompalmer Wed 25 Jun 2008
I think this parameter is like the array instance passed into
List#toArray
in Java. Is that correct?andy Wed 25 Jun 2008
You don't need the first set of square brackets:
Maps and Lists should rarely ever be created using the make() methods, unless you're doing so reflectively. But if you need to use
Map.make
(as helium noted) you need to pass in a Map Type.