public class TreeNodeComparatorBySubtreeSize extends Object implements Comparator<TreeNode>
Constructor and Description |
---|
TreeNodeComparatorBySubtreeSize()
Instantiates a new comparator sorting subtrees ascending.
|
TreeNodeComparatorBySubtreeSize(boolean reverse)
Instantiates a new comparator.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(TreeNode o1,
TreeNode o2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public TreeNodeComparatorBySubtreeSize()
public TreeNodeComparatorBySubtreeSize(boolean reverse)
true
subtrees are
sorted in descending order, otherwise ascending.reverse
- the reversepublic int compare(TreeNode o1, TreeNode o2)
compare
in interface Comparator<TreeNode>
Copyright © 2019 SEMS project @ University of Rostock. All rights reserved.