using the Firebase API's prevChild behavior, we place each element in the list after it's prev sibling or, if prevChild is null, at the beginning
350507
function positionAfter (arr, prevChild) {
    var idx
    if (prevChild === null) {
      return 0
    } else {
      idx = findIndex(arr, prevChild)
      return (idx === -1) ? arr.length : idx + 1
    }
  }
1258720
private void filter(Element list)
    {
        // Iterate all the child nodes of the given list to see who's allowed and who's not allowed inside it.
        Node child = list.getFirstChild();
        Node previousListItem = null;
        while (child != null) {
            Node nextSibling = child.getNextSibling();
            if (isAllowedInsideList(child)) {
                // Save a reference to the previous list item. Note that the previous list item is not necessarily the
                // previous sibling.
                if (child.getNodeName().equalsIgnoreCase(TAG_LI)) {
                    previousListItem = child;
                }
            } else {
                if (previousListItem == null) {
                    // Create a new list item to be able to move the invalid child.
                    previousListItem = list.getOwnerDocument().createElement(TAG_LI);
                    list.insertBefore(previousListItem, child);
                    // Hide the marker of the list item to make the list look the same after it is cleaned.
                    ((Element) previousListItem).setAttribute(ATTRIBUTE_STYLE, "list-style-type: none");
                }
                // Move the child node at the end of the previous list item because it is not allowed where it is now.
                previousListItem.appendChild(child);
            }
            child = nextSibling;
        }
    }
960737
function(obj, callback){
	        if (obj){

	            if (obj.left !== null){
	                inOrder(obj.leftchild, callback);
	            }            

	            callback.call(this,obj.element);

	            if (obj.right !== null){
	                inOrder(obj.rightchild, callback);
	            }
	        }
	    }
1306419
private boolean addInstanceOfElement(HeaderElement root, HeaderElement elem) {
        // first add to the overall sequence list
        if (null == this.hdrSequence) {
            this.hdrSequence = elem;
            this.lastHdrInSequence = elem;
        } else {
            // find the end of the list and append this new element
            this.lastHdrInSequence.nextSequence = elem;
            elem.prevSequence = this.lastHdrInSequence;
            this.lastHdrInSequence = elem;
        }
        if (null == root) {
            return true;
        }
        HeaderElement prev = root;
        while (null != prev.nextInstance) {
            prev = prev.nextInstance;
        }
        prev.nextInstance = elem;
        return false;
    }
419608
public final void replaceFirstOrChildAfter(@Nullable Node prev, Node newChild) {
    Node target = prev == null ? first : prev.next;
    checkNotNull(target, "prev doesn't have a sibling to replace.");
    replaceChild(target, newChild);
  }
387318
function( key, value, fireCallback ) {
					var self = this;
					
					var callback_result = self.options.onBeforeSave.call( self );
					if ( callback_result !== undefined && callback_result === false ) {
						return;
					}

					// if fireCallback is undefined it should be true
					fireCallback = fireCallback === undefined ? true : fireCallback;
					this.browserStorage.set( key, value );
					if ( fireCallback && value !== "" ) {
						this.options.onSave.call( this );
					}
				}
531147
function _initComplete(err) {
          if( !isResolved ) {
            isResolved = true;
            if( err ) { def.reject(err); }
            else { def.resolve(firebaseObject); }
          }
        }
232190
private GBSNode lastInList(
    GBSNode       p)
  {
    GBSNode q = p;
    p = p.rightChild();
    while (p != null)
    {
      q = p;
      p = p.rightChild();
    }
    return q;
  }
85229
function prependTo(newNode, parentNode, siblingNode) {
  parentNode.insertBefore(newNode, siblingNode || parentNode.firstChild);
}
95367
function Node(value, prev, next) {
    this.value = value;
    this.prev = prev;
    this.next = next;
  }
410940
private void afterSet(E element) {
        switch(_lastCall) {
            case NEXT:
                _previousNode = _stack.getListNode(_lastId);
                break;
            case PREVIOUS:
                _nextNode = _stack.getListNode(_lastId);
                break;
            default:
                throw new IllegalStateException();
        }
    }
651701
def after(self, *nodes: Union[AbstractNode, str]) -> None:
        
        if self.parentNode:
            node = _to_node_list(nodes)
            _next_node = self.nextSibling
            if _next_node is None:
                self.parentNode.appendChild(node)
            else:
                self.parentNode.insertBefore(node, _next_node)
943575
function(textNodes, range, positionsToPreserve, isUndo) {
            log.group("postApply " + range.toHtml());
            var firstNode = textNodes[0], lastNode = textNodes[textNodes.length - 1];
            var merges = [], currentMerge;
            var rangeStartNode = firstNode, rangeEndNode = lastNode;
            var rangeStartOffset = 0, rangeEndOffset = lastNode.length;
            var precedingTextNode;

            // Check for every required merge and create a Merge object for each
            forEach(textNodes, function(textNode) {
                precedingTextNode = getPreviousMergeableTextNode(textNode, !isUndo);
                log.debug("Checking for merge. text node: " + textNode.data + ", parent: " + dom.inspectNode(textNode.parentNode) + ", preceding: " + dom.inspectNode(precedingTextNode));
                if (precedingTextNode) {
                    if (!currentMerge) {
                        currentMerge = new Merge(precedingTextNode);
                        merges.push(currentMerge);
                    }
                    currentMerge.textNodes.push(textNode);
                    if (textNode === firstNode) {
                        rangeStartNode = currentMerge.textNodes[0];
                        rangeStartOffset = rangeStartNode.length;
                    }
                    if (textNode === lastNode) {
                        rangeEndNode = currentMerge.textNodes[0];
                        rangeEndOffset = currentMerge.getLength();
                    }
                } else {
                    currentMerge = null;
                }
            });

            // Test whether the first node after the range needs merging
            var nextTextNode = getNextMergeableTextNode(lastNode, !isUndo);

            if (nextTextNode) {
                if (!currentMerge) {
                    currentMerge = new Merge(lastNode);
                    merges.push(currentMerge);
                }
                currentMerge.textNodes.push(nextTextNode);
            }

            // Apply the merges
            if (merges.length) {
                log.info("Merging. Merges:", merges);
                for (var i = 0, len = merges.length; i < len; ++i) {
                    merges[i].doMerge(positionsToPreserve);
                }
                log.info(rangeStartNode.nodeValue, rangeStartOffset, rangeEndNode.nodeValue, rangeEndOffset);

                // Set the range boundaries
                range.setStartAndEnd(rangeStartNode, rangeStartOffset, rangeEndNode, rangeEndOffset);
                log.info("Range after merge: " + range.inspect());
            }
            log.groupEnd();
        }
470274
public static void lazyInsertAfter(Element newElement, Element after) {
        if (!after.parentNode.contains(newElement)) {
            after.parentNode.insertBefore(newElement, after.nextSibling);
        }
    }
519699
function(index) {
    if(lang.isNumber(index)&& this._elColgroup) {
        var nextSibling = this._elColgroup.childNodes[index] || null;
        this._elColgroup.insertBefore(document.createElement("col"), nextSibling);
    }
}
910367
def siblings_after(self):
        
        impl_nodelist = self.adapter.get_node_children(self.parent.impl_node)
        after_nodelist = []
        is_after_myself = False
        for n in impl_nodelist:
            if is_after_myself:
                after_nodelist.append(n)
            elif n == self.impl_node:
                is_after_myself = True
        return self._convert_nodelist(after_nodelist)
731541
function prevPoint(point, isSkipInnerOffset) {
  let node;
  let offset;

  if (point.offset === 0) {
    if (isEditable(point.node)) {
      return null;
    }

    node = point.node.parentNode;
    offset = position(point.node);
  } else if (hasChildren(point.node)) {
    node = point.node.childNodes[point.offset - 1];
    offset = nodeLength(node);
  } else {
    node = point.node;
    offset = isSkipInnerOffset ? 0 : point.offset - 1;
  }

  return {
    node: node,
    offset: offset,
  };
}