import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import static x30_pkg.x30_util.DynamicObject;
class main {
static void test_HyperCompactTreeSet() {
test_TreeSetDropIn(() -> new HyperCompactTreeSet(), set -> set.testInternalStructure());
}
static > void test_TreeSetDropIn(IF0 makeSet) { test_TreeSetDropIn(makeSet, null); }
static > void test_TreeSetDropIn(IF0 makeSet, IVF1 checkInternalStructure) {
List list = repF(1000, () -> randomID(3));
Set set = asTreeSet(list);
A cset = makeSet.get();
addAll(cset, set);
print(set);
print(cset);
assertEquals(asList(set), asList(cset));
assertEqualsVerbose(l(set), l(cset));
for (String a : shuffledIterator(list)) {
set.remove(a);
cset.remove(a);
assertEquals(asList(set), asList(cset));
assertEqualsVerbose(l(set), l(cset));
pcallF(checkInternalStructure, cset);
}
}
static List repF(int n, Object f, Object... args) {
List l = new ArrayList();
for (int i = 0; i < n; i++)
l.add(callF(f, args));
return l;
}
static List repF(Object f, int n) {
return repF(n, f);
}
static List repF(int n, IF0 f) {
return repF(f, n);
}
static int randomID_defaultLength = 12;
static String randomID(int length) {
return makeRandomID(length);
}
static String randomID(Random r, int length) {
return makeRandomID(r, length);
}
static String randomID() {
return randomID(randomID_defaultLength);
}
static String randomID(Random r) {
return randomID(r, randomID_defaultLength);
}
static TreeSet asTreeSet(Collection set) {
return set == null ? null : set instanceof TreeSet ? (TreeSet) set : new TreeSet(set);
}
static void addAll(Collection c, Iterable b) {
if (c != null && b != null) for (A a : b) c.add(a);
}
static boolean addAll(Collection c, Collection b) {
return c != null && b != null && c.addAll(b);
}
static boolean addAll(Collection c, B... b) {
return c != null && b != null && c.addAll(Arrays.asList(b));
}
static Map addAll(Map a, Map extends A,? extends B> b) {
if (a != null && b != null) a.putAll(b);
return a;
}
static volatile StringBuffer local_log = new StringBuffer(); // not redirected
static volatile Appendable print_log = local_log; // might be redirected, e.g. to main bot
// in bytes - will cut to half that
static volatile int print_log_max = 1024*1024;
static volatile int local_log_max = 100*1024;
static boolean print_silent = false; // total mute if set
static Object print_byThread_lock = new Object();
static volatile ThreadLocal