Some nodes may support client-controlled ordering of their child nodes. Whether a particular node preserves the order of its child nodes is governed by its node type. See 6.7 Node Types.
If a node supports orderable child nodes, the order of its child nodes, as reflected in the iterator acquired through Node.getNodes() can be controlled by the client using the method Node.orderBefore. The order of child nodes is persisted upon save of the parent node.
When a child node is added to a node that supports orderable child nodes it is added to the end of the list. It can then be re-ordered using the above method.