Convert DisjointSet to Kotlin

master
Graham 5 years ago
parent 429867e3af
commit c0836e11f6
  1. 13
      util/src/main/java/dev/openrs2/util/collect/DisjointSet.java
  2. 11
      util/src/main/java/dev/openrs2/util/collect/DisjointSet.kt

@ -1,13 +0,0 @@
package dev.openrs2.util.collect;
public interface DisjointSet<T> extends Iterable<DisjointSet.Partition<T>> {
interface Partition<T> extends Iterable<T> {
/* empty */
}
Partition<T> add(T x);
Partition<T> get(T x);
void union(Partition<T> x, Partition<T> y);
int elements();
int partitions();
}

@ -0,0 +1,11 @@
package dev.openrs2.util.collect
interface DisjointSet<T> : Iterable<DisjointSet.Partition<T>> {
interface Partition<T> : Iterable<T>
fun add(x: T): Partition<T>
operator fun get(x: T): Partition<T>?
fun union(x: Partition<T>, y: Partition<T>)
fun elements(): Int
fun partitions(): Int
}
Loading…
Cancel
Save