hashmap - floorEntry for Double numbers in java -
i have divided continuous range of double numbers several sub-ranges. tried create method in order map each sub-range specific string value:
static navigablemap < double, string > rrmap = new treemap < double, string > (); static hashmap < string, double > qualitymap = new hashmap < string, double > (); public static void main(string args[]) { qualitymap.put("key", 0.3); rrmap.put(0.0, "a"); // 0..11 => bradypnea rrmap.put(1.2, "b"); // 12..14 => unreliable_ranges rrmap.put(1.5, "c"); // 15..20 => normal activity rrmap.put(2.1, "d"); // 21..25 => unreliable_ranges rrmap.put(2.6, "e"); method(); } // lines of codes public static void method() { system.out.println(floorentry(qualitymap.get("key")).getvalue()); }
in function named "method", want print string value mapped number exist in qualitymap , value of "key". doesn't work , encountered error in line:
system.out.println(floorentry(qualitymap.get("key")).getvalue());
it says floorentry doesn't work doublr number. studied http://docs.oracle.com/javase/6/docs/api/java/util/treemap.html but, there wasn't restriction type of floorentry arguman. need guidance in order map range of double numbers specific value.
well, find out problem. changed wrong line of code:
system.out.println(rrmap.floorentry(qualitymap.get("key")).getvalue());
and works!
Comments
Post a Comment