1

This works fine:

TreeMap <String, ArrayList> x_probs_org = new TreeMap<String, ArrayList>();

But this:

TreeMap <String, TreeMap<String, Float>> x_probs = new <String, TreeMap<String, Float>>();

causes the following error:

error: <identifier> expected

Why? What am I doing wrong? I tried a couple of other ways but I don't see why this is wrong.

user961627
  • 12,379
  • 42
  • 136
  • 210
  • Note, rare types are bad - you want to make your `ArrayList` generic argument generic. Also it's conventional to use the interface type for the type of variables and parameters. – Tom Hawtin - tackline Mar 20 '12 at 14:37

2 Answers2

4

You forgot the TreeMap identifier:

.... = new TreeMap<String, TreeMap<String, Float>>();
dacwe
  • 43,066
  • 12
  • 116
  • 140
1

try it like that:

TreeMap <String, TreeMap<String, Float>> x_probs = new TreeMap<String, TreeMap<String, Float>>();
Tom
  • 4,096
  • 2
  • 24
  • 38