look ahead in the old array to see if the current item appears later
 thereby having items removed
18483
def index_of_match_after_deletions
      return unless expected_additions < 0

      (1..(expected_additions.abs)).each do |i|
        next_difference = item_difference(
          old_array[old_index + i],
          new_array[new_index],
          old_index
        )

        return old_index + i if next_difference.empty?
      end

      nil
    end
1234553
function getLastVisibleItem() {
                        for (var i = lastIndexDisplayed; i >= firstIndexDisplayed; i--) {
                            if (that.items.itemAt(i)) {
                                return that.items.itemAt(i);
                            }
                        }
                        return null;
                    }
1207815
function(recentEntryArray, value) {
			var indexOfElement = -1;
			
			recentEntryArray.some(function(entry, index){
				if (entry.value === value) {
					indexOfElement = index;
					return true;
				}
				return false;
			});
			
			return indexOfElement;
		}
266842
def trim(self):
        ''''''
        now_time = time.time()

        while self._seq and self._seq[0].expire_time < now_time:
            item = self._seq.popleft()
            del self._map[item.key]

        if self._max_items:
            while self._seq and len(self._seq) > self._max_items:
                item = self._seq.popleft()
                del self._map[item.key]
371031
def delete_item(name)
      previous = items.size
      items.reject! { |item| item.name == name}
      previous != items.size
    end
1236881
def _on_items_changed(self, change):
        
        if change['type'] != 'container':
            return
        op = change['operation']
        if op == 'append':
            i = len(change['value'])-1
            self.adapter.notifyItemInserted(i)
        elif op == 'insert':
            self.adapter.notifyItemInserted(change['index'])
        elif op in ('pop', '__delitem__'):
            self.adapter.notifyItemRemoved(change['index'])
        elif op == '__setitem__':
            self.adapter.notifyItemChanged(change['index'])
        elif op == 'extend':
            n = len(change['items'])
            i = len(change['value'])-n
            self.adapter.notifyItemRangeInserted(i, n)
        elif op in ('remove', 'reverse', 'sort'):
            # Reset everything for these
            self.adapter.notifyDataSetChanged()
975216
function(items) {
            items = $.makeArray(items);

            for (var i = 0; i < items.length; i++) {
                var item = items[i];

                // Make sure we actually know about this item
                var index = $.inArray(item, this.$items);
                if (index !== -1) {
                    this._deinitItem(item);
                    this.$items.splice(index, 1);
                }
            }
        }
99935
function() {
            var s = Storage.storage();
            if (s == null) {
                return false;
            }
            Object.keys(s).forEach(function(key){
                   if (/^(cache_)/.test(key)) {
                       s.removeItem(key);
                   }
            });
        }
238600
function(){
			var rect, obj, i;
            for (i=0, l=changed_objs.length; i<l; i++){
            	obj = changed_objs[i];
            	rect = obj._mbr || obj;
            	if (obj.staleRect == null)
            			obj.staleRect = {}
        		obj.staleRect._x = rect._x;
				obj.staleRect._y = rect._y;
				obj.staleRect._w = rect._w;
				obj.staleRect._h = rect._h;

				obj._changed = false
            }
            changed_objs.length = 0;
            dirty_rects.length = 0

		}
94370
function removeElements(collection, newCollection, index) {
        if (index === void 0) { index = 'id'; }
        var oldLength = collection.length;
        _.remove(collection, function (item) { return !_.some(newCollection, function (c) { return c[index] === item[index]; }); });
        return collection.length !== oldLength;
    }
394975
function replaceInArray(array, indexToReplace, indexToInsert) {
        var _removedArray = array.splice(indexToReplace, 1);
        array.splice(indexToInsert, 0, _removedArray[0]);
        return array;
    }
243978
private boolean findAndRemove(Object e) {
        if (e != null) {
            for (Node pred = null, p = head; p != null; ) {
                Object item = p.item;
                if (p.isData) {
                    if (item != null && item != FORGOTTEN && e.equals(item) &&
                        p.tryMatchData()) {
                        unsplice(pred, p);
                        return true;
                    }
                }
                else if (item == null)
                    break;
                pred = p;
                if ((p = p.next) == UNLINKED) { // stale
                    pred = null;
                    p = head;
                }
            }
        }
        return false;
    }
755294
def __clear
      old_size = @array.size

      deps        = @array_deps
      @array_deps = []

      # Trigger remove for each cell
      old_size.times do |index|
        trigger_removed!(old_size - index - 1)
      end

      # Trigger on each cell since we are clearing out the array
      if deps
        deps.each do |dep|
          dep.changed! if dep
        end
      end

      # clear the array
      @array = []
    end
519183
def previous(time, base)
      current = time
      until match?(current, base) && current < time
        pot_prev = align(potential_previous(current, base), base)
        pot_prev -= min_step if pot_prev == current

        current = pot_prev
      end

      current
    end
839544
def undo where
      raise "not yet used"
      return unless @delete_buffer
      case @delete_buffer[0]
      when Array
        @delete_buffer.each do |r| 
          insert where, r 
        end
      else
        insert where, @delete_buffer
      end
    end
528379
function _movePrev() {
        var $context, $prev;

        $context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
        if ($context.length > 0) {
            $prev = $context.prev();
            if ($prev.length === 0) {
                $prev = $("#mrof-container #mrof-list > li").last();
            }
            if ($prev.length > 0) {
                $currentContext = $prev;
                $prev.find("a.mroitem").trigger("focus");
            }
        } else {
            //WTF! (Worse than failure). We should not get here.
            $("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
        }
    }
44295
function erase(arr, item) {
	var i = arr.length;
	while (i--) {
		if (arr[i] === item) {
			arr.splice(i, 1);
			break;
		}
	}
	//return arr;
}