title: Resetting RecyclerView to its initail onCreate state
body: <p>I have an simple app that displays texts in a <code>RecyclerView</code>. The <code>fab</code> adds new words to the recyclerview list each time it'os clicked.</p>
  
  <p>My problem now is resetting the <code>RecyclerView</code> to its original state (when activity was first created) when I click on <strong>Reset</strong> in the options menu. I have tried different ways like <code>mRecyclerView.invalidate();</code> then calling <code>notifydataSetChanged();</code> on the <strong>mAdapter</strong>. Also using <code>getRecycledViewPool().clear();</code>. All to no avail.</p>
  
  <p>Here's my MainActivity Code:</p>
  
  <pre><code>package com.example.recyclerview;
  
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.widget.Toolbar;
  import androidx.recyclerview.widget.LinearLayoutManager;
  import androidx.recyclerview.widget.RecyclerView;
  
  import com.example.recyclerview.adapters.WordListAdapter;
  import com.google.android.material.floatingactionbutton.FloatingActionButton;
  
  import java.util.LinkedList;
  
  public class MainActivity extends AppCompatActivity {
      private final LinkedList&lt;String&gt; mWordList = new LinkedList&lt;&gt;();
      private RecyclerView mRecyclerView;
      private WordListAdapter mAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          mRecyclerView = findViewById(R.id.recyclerView);
          mAdapter = new WordListAdapter(this, mWordList);
          mRecyclerView.setAdapter(mAdapter);
          mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
  
  
  
          for (int i = 0; i &lt; 20; i++) {
              mWordList.addLast("Word " + i);
          }
  
          FloatingActionButton fab = findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  int mWordListSize = mWordList.size();
                  mWordList.addLast("Word " + mWordListSize);
                  mRecyclerView.getAdapter().notifyItemInserted(mWordListSize);
                  mRecyclerView.smoothScrollToPosition(mWordListSize);
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
          if (id == R.id.reset) {
              // Resetting the RecyclerView
              mAdapter = new WordListAdapter(this, mWordList);
              mRecyclerView.setAdapter(mAdapter);
              mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  
  </code></pre>
  
  <p>and here'os my Adapter Code:</p>
  
  <pre><code>package com.example.recyclerview.adapters;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import androidx.annotation.NonNull;
  import androidx.recyclerview.widget.RecyclerView;
  
  import com.example.recyclerview.R;
  
  import java.util.LinkedList;
  
  public class WordListAdapter extends RecyclerView.Adapter&lt;WordListAdapter.WordViewHolder&gt; {
      private final LinkedList&lt;String&gt; mWordList;
      private LayoutInflater mInflater;
  
      public WordListAdapter(Context context, LinkedList&lt;String&gt; wordList) {
          mInflater = LayoutInflater.from(context);
          this.mWordList = wordList;
      }
  
      @NonNull
      @Override
      public WordListAdapter.WordViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View itemView = mInflater.inflate(R.layout.wordlist_item, parent, false);
          return new WordViewHolder(itemView, this);
      }
  
      @Override
      public void onBindViewHolder(@NonNull WordListAdapter.WordViewHolder holder, int position) {
          String mCurrent = mWordList.get(position);
          holder.wordItemView.setText(mCurrent);
      }
  
      @Override
      public int getItemCount() {
          return mWordList.size();
      }
  
      class WordViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
          public final TextView wordItemView;
          final WordListAdapter mAdapter;
  
          public WordViewHolder(@NonNull View itemView, WordListAdapter adapter) {
              super(itemView);
              wordItemView = itemView.findViewById(R.id.word);
              this.mAdapter = adapter;
              itemView.setOnClickListener(this);
          }
  
          @Override
          public void onClick(View v) {
              int mPosition = getLayoutPosition();
              String element = mWordList.get(mPosition);
              mWordList.set(mPosition, "Clicked" + element);
              mAdapter.notifyDataSetChanged();
          }
      }
  }
  </code></pre>
  
  <p><strong>Extra:</strong></p>
  
  <p>Any help as to how i can manage click efficiently (without having to handle each item click in the adapter??
  Thanks</p>