order. This will combine the most recent two deltas if they are the same.
350414
private Deque<MutablePair<DeltaType, Object>> combineDeltas(
      LinkedList<MutablePair<DeltaType, Object>> deltas) {
    if (deltas.size() < 2) {
      return deltas;
    }
    int size = deltas.size();
    MutablePair<DeltaType, Object> d1 = deltas.peekLast();
    MutablePair<DeltaType, Object> d2 = deltas.get(size - 2);
    MutablePair<DeltaType, Object> out = isDuplicate(d1, d2);
    if (out != null) {
      Deque<MutablePair<DeltaType, Object>> newDeltas = new LinkedList<>();
      newDeltas.addAll(deltas.subList(0, size - 2));
      newDeltas.add(out);
      return newDeltas;
    }
    return deltas;
  }
448253
public void deltaTotalCreationTime(long delta)
   {
      if (enabled.get() && delta > 0)
      {
         totalCreationTime.addAndGet(delta);

         if (delta > maxCreationTime.get())
            maxCreationTime.set(delta);
      }
   }
503950
public long getAndAdd(T obj, long delta) {
        long prev, next;
        do {
            prev = get(obj);
            next = prev + delta;
        } while (!compareAndSet(obj, prev, next));
        return prev;
    }
110030
def _add_timedelta(self, delta):
        
        if isinstance(delta, pendulum.Duration):
            return self.add(
                years=delta.years,
                months=delta.months,
                weeks=delta.weeks,
                days=delta.remaining_days,
            )

        return self.add(days=delta.days)
852792
public void combine(SpdLoad other) {
        if (other == null)
            return;
        if (stat.isEnabled() && other.isEnabled())
            //stat.combine((BoundedRangeStatisticImpl)other.getStatistic());
            stat.combine(other.getStatistic());
    }
178095
public static function equalWithin($a, $b, $delta)
    {
        if (is_infinite($a) xor is_infinite($b)) {
            return false;
        }

        if (is_nan($a) || is_nan($b) || is_nan($delta)) {
            return false;
        }

        return abs($a - $b) <= $delta;
    }
543218
protected void ensureCapacity(int delta) {
        if (m_bb.position() + delta > m_bb.capacity()) {
            ByteBuffer oldbb = m_bb.asReadOnlyBuffer();
            oldbb.flip();

            int newCapacity = oldbb.capacity() * 2;
            while (newCapacity < (oldbb.capacity() + delta)) {
                newCapacity *= 2;
            }

            ByteBuffer newbb = ByteBuffer.allocateDirect(newCapacity);
            newbb.put(oldbb);

            DBBPool.wrapBB(m_bb).discard();
            m_bb = newbb;
        }
    }
1006484
def next_future_periodic_delta(self) -> Optional[float]:
        """"""
        try:
            next_event = self._scheduler.queue[0]
        except IndexError:
            return None

        now = time.monotonic()
        next_event_time = next_event[0]
        if next_event_time < now:
            return 0

        return next_event_time - now
64174
public static int combine(int status1, int status2) {
    return Math.max(action(status1), action(status2)) | Math.max(scope(status1), scope(status2));
  }
395369
private void nextFrame(long delta) {
		if (stopped) {
			return;
		}
		if (frames.size() == 0) {
			return;
		}
		
		nextChange -= delta;
		
		while (nextChange < 0 && (!stopped)) {
			if (currentFrame == stopAt) {
				stopped = true;
				break;
			}
			if ((currentFrame == frames.size() - 1) && (!loop) && (!pingPong)) {
	            stopped = true; 
				break;
			}
			currentFrame = (currentFrame + direction) % frames.size();
			
			if (pingPong) {
				if (currentFrame <= 0) {
					currentFrame = 0;
					direction = 1;   
					if (!loop) {            
                        stopped = true;            
                        break;     
                    }       
				}
				else if (currentFrame >= frames.size()-1) {
					currentFrame = frames.size()-1;
					direction = -1;
				}
			}
			int realDuration = (int) (((Frame) frames.get(currentFrame)).duration / speed);
			nextChange = nextChange + realDuration;
		}
	}
44826
private boolean _createDeltas()
    {
        if (isInitialStateMarked())
        {
            if (_deltas == null)
            {
                _deltas = new HashMap<Serializable, Object>(2);
            }
            return true;
        }

        return false;
    }
1093204
@SuppressWarnings("unchecked")
    public static NumberList delta(NumberList currentMap, NumberList previousMap) {
        return delta((Map)currentMap.numbers, (Map)previousMap.numbers);
    }
124646
public int addAndGet(T obj, int delta) {
        int prev, next;
        do {
            prev = get(obj);
            next = prev + delta;
        } while (!compareAndSet(obj, prev, next));
        return next;
    }
658014
private void resolveToCurrent(List<Delta<E>> deltas)
    {
        int lineOffset = 0;

        for (Delta<E> d : deltas) {
            Chunk<E> original = d.getOriginal();
            Chunk<E> revised = d.getRevised();

            int pos = original.getPosition() + lineOffset;
            // delete lines
            for (int i = 0; i < original.size(); i++) {
                int origLine = elementList.remove(pos);
                currentRevisionContent.remove(pos);
                if (origLine != -1) {
                    sourceRevisions.set(origLine, currentRevision);
                }
            }

            for (int i = 0; i < revised.size(); i++) {
                currentRevisionContent.add(pos + i, revised.getLines().get(i));
                elementList.add(pos + i, -1);
            }

            lineOffset += revised.size() - original.size();
        }
    }
418648
protected boolean combine(Object[] srcs, TupleWritable dst) {
    assert srcs.length == dst.size();
    for (int i = 0; i < srcs.length; ++i) {
      if (!dst.has(i)) {
        return false;
      }
    }
    return true;
  }
1249863
def equal(self, other, delta=0.0):
        
        if (other is None):
            return False
        if (self.uri != other.uri):
            return(False)
        if (self.timestamp is not None or other.timestamp is not None):
            # not equal if only one timestamp specified
            if (self.timestamp is None or
                    other.timestamp is None or
                    abs(self.timestamp - other.timestamp) >= delta):
                return(False)
        if ((self.md5 is not None and other.md5 is not None) and
                self.md5 != other.md5):
            return(False)
        if ((self.length is not None and other.length is not None) and
                self.length != other.length):
            return(False)
        return(True)
581775
public boolean eq(LongDoubleSortedVector other, double delta) {
        // This is slow, but correct.
        LongDoubleSortedVector v1 = LongDoubleSortedVector.getWithNoZeroValues(this, delta);
        LongDoubleSortedVector v2 = LongDoubleSortedVector.getWithNoZeroValues(other, delta);
                
        if (v2.size() != v1.size()) {
            return false;
        }

        for (LongDoubleEntry ve : v1) {
            if (!Primitives.equals(ve.get(), v2.get(ve.index()), delta)) {
                return false;
            }
        }
        for (LongDoubleEntry ve : v2) {
            if (!Primitives.equals(ve.get(), v1.get(ve.index()), delta)) {
                return false;
            }
        }
        return true;
    }