X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Futil%2Fdata%2FNodeImpl.java;h=266cea1f49533e958b57c5101c88abd103cf0160;hb=f52356f8351e099a243ee7b470a37f449bc88b1b;hp=785fa1f25d5a1f65c140c5895e9a1eb520ec7206;hpb=95caf3bdb2b7946e4f20a45025f730dd47c5985c;p=jSite2.git diff --git a/src/net/pterodactylus/util/data/NodeImpl.java b/src/net/pterodactylus/util/data/NodeImpl.java index 785fa1f..266cea1 100644 --- a/src/net/pterodactylus/util/data/NodeImpl.java +++ b/src/net/pterodactylus/util/data/NodeImpl.java @@ -2,6 +2,8 @@ package net.pterodactylus.util.data; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; import java.util.List; @@ -12,7 +14,7 @@ import java.util.List; * @param * The type of the element to store */ -class NodeImpl implements Node { +class NodeImpl> implements Node { /** The parent node of this node. */ private final Node parentNode; @@ -199,4 +201,29 @@ class NodeImpl implements Node { return null; } + /** + * {@inheritDoc} + */ + public void sortChildren() { + Collections.sort(children); + } + + /** + * {@inheritDoc} + */ + public void sortChildren(Comparator> comparator) { + Collections.sort(children, comparator); + } + + // + // INTERFACE Comparable + // + + /** + * {@inheritDoc} + */ + public int compareTo(Node otherNode) { + return element.compareTo(otherNode.getElement()); + } + } \ No newline at end of file