Android 3.2, Java 1.7.Realm 4.1.0
Здесь код:
public class LocalizedString extends RealmObject {
private RealmList<TranslatedString> translations;
public void cascadeUpdate(Realm realm, LocalizedString that) {
if (!EqualsUtil.areEqualContentLists(this.translations, that.translations)) {
if (that.translations == null) {
setTranslations(null);
} else {
if (translations == null) {
translations = realm.copyToRealm(new RealmList<TranslatedString>()); // error!!!
}
}
}
}
public class TranslatedString extends RealmObject {
private String locale;
private String value;
}
Мне нужно инициализировать список, когда translations = null
.Поэтому я пытаюсь это:
translations = realm.copyToRealm(new RealmList<TranslatedString>());
Здесь ошибка компиляции:
error: incompatible types: no instance(s) of type variable(s) E exist so that List<E> conforms to RealmList<TranslatedString>