public ObservableList loadObservableList ( String breadcrumb , ObservableList defaultObservableList ) { String json = getSerializedPreferencesValue ( breadcrumb , gson . toJson ( defaultObservableList ) ) ; return FXCollections . observableArrayList ( gson . fromJson ( json , ArrayList . class ) ) ; }
Searches in the preferences after a serialized ArrayList using the given key deserializes and returns it as ObservableArrayList . When an ObservableList is deserialzed Gson returns an ArrayList and needs to be wrapped into an ObservableArrayList . This is only needed for loading .