TestRoots / watchdog

IntelliJ & Eclipse plugin for monitoring how Java applications are developed and tested
http://www.testroots.org
Other
18 stars 10 forks source link

Change collection type of projectsettings to Map #300

Open TimvdLippe opened 6 years ago

TimvdLippe commented 6 years ago

The current implementation in Preferences is that the project settings are a list. The invariant of "one project in this collection" is manually enforced with getOrCreateProjectSetting. However, we can better use Map here (and implement the corresponding equals/hashcode) to let the collection do this for us. That way we can make sure we always have one by retrieving it directly from https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#getOrDefault-java.lang.Object-V- and put the value whenever we need it.

Inventitech commented 6 years ago

Yeah, I think the reason is the Eclipse persister, which does (did) not support the Map datatype.