java - String cannot be applied to com.org.apache.xpath.internal.operations.String -
i'm trying create piechart in javafx, , want fill data hashmap.
here's code:
public graph(hashmap<string, double> chartdata) { observablelist<piechart.data> piechartdata = fxcollections.observablearraylist(); (map.entry<string, double> entry: chartdata.entryset()) { string s = entry.getkey(); new piechart.data(entry.getkey(), entry.getvalue()); //system.out.println("key = " + entry.getkey() + ", value = " + entry.getvalue()); } chart = new piechart(piechartdata); chart.settitle("imported fruits"); } the issue facing when try use entry.getkey() string, following error:
data (java.lang.string, double) in data cannot applied (com.org.apache.xpath.internal.operations.string, double).
the string marked red , when replace entry.getkey() "some text" work. cause?
you seem have imported wrong "string" class ( com.org.apache.xpath.internal.operations.string) in current file , data class expects correct 1 (java.lang.string). make sure imports correct (i.e. remove import of first type).
also see this question, asker has run similar problem
Comments
Post a Comment