最近我在使用spring-data-couchbase和spring时发现了一些奇怪的问题,只是试图在Repository中实现find操作。为了解决我的问题,我在这个旧页面(https://www.humansreadcode.com/spring-boot-completablefuture/)中看到public class FragmentB extends Fragment {
private RecyclerView mRecyclerView;
private FragmentBAdapter adapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_b, container, false);
mRecyclerView = view.findViewById(R.id.recycler_view_b);
mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
adapter = new FragmentBAdapter(getActivity(), MyActivity.myList);
mRecyclerView.setAdapter(adapter);
return view;
}
public void updateRecyclerViewData() {
if (adapter != null)
adapter.notifyDataSetChanged();
}
... other methods
}
不被支持作为返回值。
是真的吗(我找不到相关的文档)?
如果不是,即使CompletableFuture<Optional<SomeObject>>
和CompletableFuture
都是有效的返回类型,是否有任何原因呢?