sample update: constructor doesn't have fun keyword before this
This commit is contained in:
@@ -2,7 +2,7 @@ class BinaryHeap<T> : IPriorityQueue<T> {
|
|||||||
private val data : IMutableList<T>
|
private val data : IMutableList<T>
|
||||||
private val compare : Comparison<T>
|
private val compare : Comparison<T>
|
||||||
|
|
||||||
fun this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) {
|
this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) {
|
||||||
this.compare = compare
|
this.compare = compare
|
||||||
this.data = ArrayList(data)
|
this.data = ArrayList(data)
|
||||||
siftDown(* this.data.size / 2 .. 0)
|
siftDown(* this.data.size / 2 .. 0)
|
||||||
@@ -13,12 +13,12 @@ class BinaryHeap<T> : IPriorityQueue<T> {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
fun this(compare : Comparison<T>) {
|
this(compare : Comparison<T>) {
|
||||||
this.compare = compare
|
this.compare = compare
|
||||||
this.data = ArrayList()
|
this.data = ArrayList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun this() {
|
this() {
|
||||||
this.data = ArrayList()
|
this.data = ArrayList()
|
||||||
Assert(T is IComparable<T>)
|
Assert(T is IComparable<T>)
|
||||||
this.comparator = naturalOrder<T>
|
this.comparator = naturalOrder<T>
|
||||||
|
|||||||
Reference in New Issue
Block a user