Question: I have a RecyclerView and I need some `if statement` in my Adapter to make RecyclerView skip and do not create an item if one field in my ViewModel is empty. For example I have ViewModel with title and picture in it, so if the title is empty - do not create an item for it. So:

```
if (TextUtils.isEmpty(viewModel.getMessages().getTitle())) {
//do something?
}

```

This should be easy enough, but I just started practicing RecyclerView :)

Answer: 
If you need to remove item use

```
list.remove(position)
adapter.notifyItemRemoved(position)

```
Put the creation of item itself in an if statement.

Example:- 

```
if ((viewModel.get(position).getTitle()) != null) {

     holder.textView.setText(viewModel.get(position).getTitle());

}

```