So i have constructor that looks so:
public Group(Entry<String, List<String>> rawGroup) {
permission=rawGroup.getKey();
List<String> params = rawGroup.getValue();
limits = Integer.parseInt(params.get(0));
int a = Integer.parseInt(params.get(1));
int b = Integer.parseInt(params.get(2));
s1 = Math.min(a, b);
s2 = Math.max(a, b);
}
And "List params = rawGroup.getValue();" makes that:
java.lang.ClassException: java.lang.String cannot be cast to java.util.List
I can't understand why this is happening, getValue() can't return String because it's not String
UPDATE: Entry is a part of EntrySet that returns Map
UPDATE2: so here's code that uses that constructor -
Map<String, List<String>> rawGroups = (Map) holder.config.getConfigurationSection(HEADING).getValues(true);
for (Entry<String, List<String>> rawGroup : rawGroups.entrySet()) {
groups.add(new Group(rawGroup));
}
Entry? What doesgetValuereturn?Entryclass is and how itsgetValuefunction works.Entryisn't a standard JDK or JEE class or interface, so...Map.Entry, which is a standard JDK class. But we don't know if that what the OP means withEntry.Entryhas something in it that's not supposed to be there. We can't help you from this short snippet because the problem is not here, it's somewhere else, where incorrect values get put in the map somehow. Or possibly you get aMapfrom somewhere, and have misunderstood what it is supposed to store.holder.config.getConfigurationSection(HEADING).getValues(true);and find out what it actually returns. It's not aMap<String, List<String>>. If it's code that you wrote and there is no documentation, you need to examine that code.