title: DiffUtil not updating recyclerview
body: <p>I am using below code to test <a href="https://developer.android.com/reference/android/support/v7/util/DiffUtil" rel="nofollow noreferrer">DiffUtil</a> implementaion.As per doc-</p>
  
  <blockquote>
    <p>DiffUtil is a utility class that can calculate the difference between
    two lists and output a list of update operations that converts the
    first list into the second one.</p>
  </blockquote>
  
  <p>My newlist has one more item than old list.But my adapter displays old list only even after calling dispatchUpdatesTo on adapter.</p>
  
  <pre><code>  val diffResult = DiffUtil.calculateDiff(MyDiffCallback(newlist, commitmentList),true);
    commitmentList=newlist
    diffResult.dispatchUpdatesTo(commitmentAdapter);
  </code></pre>
  
  <p>MyDiffCallback.java</p>
  
  <pre><code>public class MyDiffCallback extends DiffUtil.Callback{
  
      ArrayList&lt;Commitment&gt; oldPersons;
      ArrayList&lt;Commitment&gt; newPersons;
  
      public MyDiffCallback(ArrayList&lt;Commitment&gt; newPersons, ArrayList&lt;Commitment&gt; oldPersons) {
          this.newPersons = newPersons;
          this.oldPersons = oldPersons;
      }
  
      @Override
      public int getOldListSize() {
          return oldPersons.size();
      }
  
      @Override
      public int getNewListSize() {
          return newPersons.size();
      }
  
      @Override
      public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
  
          return(oldPersons.get(oldItemPosition)
                  .equals(newPersons.get(newItemPosition)));    }
  
      @Override
      public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
  
          return(oldPersons.get(oldItemPosition)
                  .compareTo(newPersons.get(newItemPosition))==0);    }
  
  
  }
  </code></pre>
  
  <p>Adapter</p>
  
  <pre><code>class CommitmentAdapter(private val context: Context, private val data: ArrayList&lt;Commitment&gt;?) : RecyclerView.Adapter&lt;CommitmentAdapter.ViewHolder&gt;() {
  
  
      override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CommitmentAdapter.ViewHolder {
  
          val itemView = LayoutInflater.from(parent.context)
                  .inflate(R.layout.item_commitment, parent, false)
  
          return ViewHolder(itemView)
      }
  
      override fun getItemCount(): Int {
          return data!!.size
      }
  
      override fun onBindViewHolder(holder: CommitmentAdapter.ViewHolder, position: Int) {
  
          holder.bindata(data!![position],position,context)
      }
  
      class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
          fun bindata(data: Commitment,position:Int,context: Context) {
            var pedoDB: PedometerDaoImpl=PedometerDaoImpl(context)
              itemView.tvDate.text = "Start date : " + getDat(data.startDate!!.toLong()* 1000L) + "  End date : " + getDat(data.endDate!!.toLong()* 1000L)
              itemView.pb_calories.max = 100
  
              itemView.clCommitment.tag=position
              itemView.clCommitment.setOnClickListener {
                  val intent= Intent(context,EditCommitment::class.java).putExtra("Data",data)
                  context.startActivity(intent)
  
              }
  
  
          }
  
          fun getDat(timeStamp: Long): String {
  
              try {
                  val sdf = SimpleDateFormat("dd/MM/yyyy")
                  val netDate = Date(timeStamp)
                  return sdf.format(netDate)
              } catch (ex: Exception) {
                  return "xx"
              }
  
          }
      }
  
  }
  </code></pre>