public void add(long delay, T value) {
    Node<T> newNode = new Node<T>(value, delay);

    Node<T> prev = null;
    Node<T> next = head;

    while (next != null && next.delay <= newNode.delay) {
      newNode.delay -= next.delay;
      prev = next;
      next = next.next;
    }

    if (prev == null) {
      head = newNode;
    } else {
      prev.next = newNode;
    }

    if (next != null) {
      next.delay -= newNode.delay;

      newNode.next = next;
    }
    size++;
  }
Adds a node to the queue.

@param delay the delay
@param value the node to add
imagepipeline-base-test/src/main/java/com/facebook/imagepipeline/testing/DeltaQueue.java