Android 3.2,java 1.7。领域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>