java - List<?> adding and removing elements -


i'm programming bukkit plugin (bukkit minecraft server type ;) ) , there, you've got method in class named yamlconfiguration has following method:

public list<?> getlist(string path) 

my problem is: i'd add and/or remove elements list returned. when try via

yamlconfiguration config = yamlconfiguration.load("path/to/config.yml"); config.getlist("a.path").add(new string("foo")); 

eclipse throwing error because

the method add(capture#2-of ?) in type list<capture#2-of ?> not applicable arguments (string)

i don't know do. ^^'

regards.

do want load item getlist? there's getstringlist(...) available.

so maybe try:

config.getstringlist("a.path").add("foo"); 

Comments