Problems with Configurate and getting a List object

Found some code that provides the function-filler for the .getList() method of Configurate’s node reading… works fine to import a list from HOCON into a List object, but the problem is that the list it makes is an IMMUTABLE list, so I can’t make changes to my list which kinda defeats the purpose of a configuration element. I’ve temporarily gotten around this by making a readonly list import, then copying all the contents over to a different list object, which is mutable, and i then write that list data object back to the config when saving.

There must be a better way than my workaround solution, for a system that “Supports Lists”… what might I be overlooking?

@DefaultConfig(sharedRoot = false)
private ConfigurationLoader<CommentedConfigurationNode>	configManager;

private ConfigurationNode								config			= null;
public List<String>										passthruUsers	= new ArrayList<String>();

	config = configManager.load();
	List<String> readonlyList = config.getNode("access", "allowed").getList(new Function<Object, String>() {
		@Override
		public String apply(Object obj) {
			return (String) obj;
		}
	});
	;

Personally, this is how I do it:

someList=[
  "something"
  "something_else"
  "etc"
]
public List<String> getSomeList(ConfigurationNode node) {
    return node.getNode("someList").getChildrenList().stream()
        .map(ConfigurationNode::getString).collect(Collectors.toList());
}

Most Excellent!
No immutable errors!

Thank you very much - now its moving forward (effectively) time again… :smile: