public void newData(@Nonnull ChangesAdapter adapter,@Nonnull List<T> values,boolean force){
  checkNotNull(adapter);
  checkNotNull(values);
  final H[] list=apply(values);
  final LinkedList<H> objects=new LinkedList<>();
  Collections.addAll(objects,mItems);
  clearState();
  int successPosition=0;
  for (; successPosition < list.length; ) {
    final H item=list[successPosition];
    final int i=indexOfItem(objects,item);
    if (i < 0) {
      executeAction(adapter,ACTION_INSERT,successPosition);
      successPosition+=1;
    }
 else     if (i == 0) {
      if (force || !mDetector.same(item,objects.get(0))) {
        executeAction(adapter,ACTION_CHANGED,successPosition);
      }
 else {
        executeAction(adapter,ACTION_NONE,successPosition);
      }
      objects.remove(0);
      successPosition+=1;
    }
 else {
      final H first=objects.get(0);
      if (existInList(list,successPosition + 1,first)) {
        adapter.notifyItemMoved(i + successPosition,successPosition);
        if (force || !mDetector.same(item,objects.get(i))) {
          executeAction(adapter,ACTION_CHANGED,successPosition);
        }
 else {
          executeAction(adapter,ACTION_NONE,successPosition);
        }
        objects.remove(i);
        successPosition+=1;
      }
 else {
        executeAction(adapter,ACTION_REMOVE,successPosition);
        objects.remove(0);
      }
    }
  }
  executeAction(adapter,ACTION_NONE,successPosition);
  if (objects.size() > 0) {
    adapter.notifyItemRangeRemoved(successPosition,objects.size());
    objects.clear();
  }
  mItems=list;
}

public void newData ( @ Nonnull ChangesAdapter adapter , @ Nonnull List < T > values , boolean force ) { checkNotNull ( adapter ) ; checkNotNull ( values ) ; final H [ ] list = apply ( values ) ; final LinkedList < H > objects = new LinkedList < > ( ) ; Collections . addAll ( objects , mItems ) ; clearState ( ) ; int successPosition = 0 ; for ( ; successPosition < list . length ; ) { final H item = list [ successPosition ] ; final int i = indexOfItem ( objects , item ) ; if ( i < 0 ) { executeAction ( adapter , ACTION_INSERT , successPosition ) ; successPosition += 1 ; } else if ( i == 0 ) { if ( force || ! mDetector . same ( item , objects . get ( 0 ) ) ) { executeAction ( adapter , ACTION_CHANGED , successPosition ) ; } else { executeAction ( adapter , ACTION_NONE , successPosition ) ; } objects . remove ( 0 ) ; successPosition += 1 ; } else { final H first = objects . get ( 0 ) ; if ( existInList ( list , successPosition + 1 , first ) ) { adapter . notifyItemMoved ( i + successPosition , successPosition ) ; if ( force || ! mDetector . same ( item , objects . get ( i ) ) ) { executeAction ( adapter , ACTION_CHANGED , successPosition ) ; } else { executeAction ( adapter , ACTION_NONE , successPosition ) ; } objects . remove ( i ) ; successPosition += 1 ; } else { executeAction ( adapter , ACTION_REMOVE , successPosition ) ; objects . remove ( 0 ) ; } } } executeAction ( adapter , ACTION_NONE , successPosition ) ; if ( objects . size ( ) > 0 ) { adapter . notifyItemRangeRemoved ( successPosition , objects . size ( ) ) ; objects . clear ( ) ; } mItems = list ; }
inform adapter about new data
