I want to run a method periodically such that it returns an ArrayList
of a custom object. Here is my code snippet,
subscribe = Observable.interval(5, TimeUnit.SECONDS)
.map(new Func1<Long, ArrayList<Item>>() {
@Override
public ArrayList<Item> call(Long aLong) {
return new ArrayList<Item>(aLong.intValue());
}
});
However, this gives an error
map(rx.functions.Func1<? super T, ? extends R>)
in Observable cannot be applied to(anonymous rx.functions.Func1<java.lang.Long, java.util.ArrayList<com.example.Item>>)
This works fine when the returned value is an ArrayList<String>
. I do not understand what the problem is here. Are custom objects not allowed?