title: getAdapterPosition() is deprecated
body: <p>I've updated my <code>targetSdkVersion</code> from 28 to 30 and I've noticed that <code>getAdapterPosition()</code> is deprecated (I'm not sure when this happened).</p>
  <p>In the <a href="https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder#getAdapterPosition()" rel="noreferrer">documentation</a>, they say the following:</p>
  <blockquote>
  <p>This method is deprecated.<br>
  This method is confusing when adapters nest other adapters. If you are calling this in the context of an Adapter, you probably want to call <a href="https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapterPosition()" rel="noreferrer">getBindingAdapterPosition()</a> or if you want the position as RecyclerView sees it, you should call <a href="https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder#getAbsoluteAdapterPosition()" rel="noreferrer">getAbsoluteAdapterPosition()</a>.</p>
  </blockquote>
  <p>The documentation also says the following:</p>
  <blockquote>
  <p>Note that if you are querying the position as RecyclerView sees, you should use <a href="https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder#getAbsoluteAdapterPosition()" rel="noreferrer">getAbsoluteAdapterPosition()</a> (e.g. you want to use it to save scroll state). If you are querying the position to access the RecyclerView.Adapter contents, you should use <a href="https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapterPosition()" rel="noreferrer">getBindingAdapterPosition()</a>.</p>
  </blockquote>
  <p>How I understand it is:</p>
  <ul>
  <li><code>getBindingAdapterPosition</code> should be used when you want to get the adapter position (if it still exists in the adapter). If it no longer exists in the adapter, it will return <code>-1</code>(<a href="https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView#NO_POSITION" rel="noreferrer">NO_POSITION</a>).</li>
  <li><code>getAbsoluteAdapterPosition</code> should be used to get the position as the <code>RecyclerView</code> sees it. For example, if an item has been deleted, but not yet removed from the<code>ViewHolder</code>.</li>
  </ul>
  <p>In other words, if I have <code>4</code> items in my <code>Adapter</code>, I delete position <code>0</code> and query <code>getAbsoluteAdapterPosition</code> and <code>getBindingAdapterPosition</code> before the item has been removed from the <code>ViewHolder</code>, then <code>getAbsoluteAdapterPosition</code> will return <code>0</code>(because view is still in the <code>ViewHolder</code>) and <code>getBindingAdapterPosition</code> return <code>-1</code>(Because it no longer exists in the adapter).</p>
  <hr />
  <p>I have tested the difference by logging the following:</p>
  <pre><code>Log.e(&quot;difference&quot;, &quot;getAdapterPosition = &quot;+myHolder.getAdapterPosition()+&quot; getBindingAdapterPosition = &quot;+myHolder.getBindingAdapterPosition()+&quot; getAbsoluteAdapterPosition = &quot;+myHolder.getAbsoluteAdapterPosition());
  </code></pre>
  <p>They return exactly the same values. I could not see any difference.</p>
  <p>I also see no difference before or after calling <code>notifyItemChanged</code>, <code>notifyDataSetChanged</code> or <code>notifyItemRangeChanged</code>. But when I delete position <code>0</code> and call <code>notifyItemRemoved</code> it returns <code>-1</code> afterward (for all of them).</p>
  <h2>My questions</h2>
  <p>Do I understand this correctly, and when should we be using which? Also, when will there be a difference?</p>