// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java
// public final class KTypeCursor<KType> {
//   /**
//    * The current value's index in the container this cursor belongs to. The
//    * meaning of this index is defined by the container (usually it will be an
//    * index in the underlying storage buffer).
//    */
//   public int index;
// 
//   /**
//    * The current value.
//    */
//   public KType value;
// 
//   @Override
//   public String toString() {
//     return "[cursor, index: " + index + ", value: " + value + "]";
//   }
// }
// 
// Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java
// public interface KTypePredicate<KType> {
//   public boolean apply(KType value);
// }
// 
// Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java
// public interface KTypeProcedure<KType> {
//   public void apply(KType value);
// }
// 
// Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java
// public static void assertSortedListEquals(Object[] array, Object... elements) {
//   assertEquals(elements.length, array.length);
//   Arrays.sort(array);
//   assertArrayEquals(elements, array);
// }


import com.carrotsearch.hppc.cursors.KTypeCursor;
import com.carrotsearch.hppc.predicates.KTypePredicate;
import com.carrotsearch.hppc.procedures.KTypeProcedure;
import com.carrotsearch.randomizedtesting.RandomizedTest;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicInteger;
import static com.carrotsearch.hppc.TestUtils.assertSortedListEquals;
import static org.junit.Assert.*;
            set.clear();

            for (int round = 0; round < size * 20; round++)
            {
                Integer key = rnd.nextInt(size);
                if (rnd.nextInt(50) == 0) {
                  key = Intrinsics.empty();
                }

                if (rnd.nextBoolean())
                {
                    if (rnd.nextBoolean()) {
                        int index = set.indexOf(cast(key));
                        if (set.indexExists(index)) {
                            set.indexReplace(index, cast(key));
                        } else {
                            set.indexInsert(index, cast(key));
                        }
                    } else {
                        set.add(cast(key));
                    }
                    other.add(cast(key));

                    assertTrue(set.contains(cast(key)));
                    assertTrue(set.indexExists(set.indexOf(cast(key))));
                }
                else
                {
                    assertEquals(other.contains(key), set.contains(cast(key)));
                    boolean removed;
// Path: hppc/src/main/templates/com/carrotsearch/hppc/cursors/KTypeCursor.java
// public final class KTypeCursor<KType> {
//   /**
//    * The current value's index in the container this cursor belongs to. The
//    * meaning of this index is defined by the container (usually it will be an
//    * index in the underlying storage buffer).
//    */
//   public int index;
// 
//   /**
//    * The current value.
//    */
//   public KType value;
// 
//   @Override
//   public String toString() {
//     return "[cursor, index: " + index + ", value: " + value + "]";
//   }
// }
// 
// Path: hppc/src/main/templates/com/carrotsearch/hppc/predicates/KTypePredicate.java
// public interface KTypePredicate<KType> {
//   public boolean apply(KType value);
// }
// 
// Path: hppc/src/main/templates/com/carrotsearch/hppc/procedures/KTypeProcedure.java
// public interface KTypeProcedure<KType> {
//   public void apply(KType value);
// }
// 
// Path: hppc/src/test/java/com/carrotsearch/hppc/TestUtils.java
// public static void assertSortedListEquals(Object[] array, Object... elements) {
//   assertEquals(elements.length, array.length);
//   Arrays.sort(array);
//   assertArrayEquals(elements, array);
// }


// Path: hppc/src/test/templates/com/carrotsearch/hppc/KTypeWormSetTest.java
import com.carrotsearch.hppc.cursors.KTypeCursor;
import com.carrotsearch.hppc.predicates.KTypePredicate;
import com.carrotsearch.hppc.procedures.KTypeProcedure;
import com.carrotsearch.randomizedtesting.RandomizedTest;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicInteger;
import static com.carrotsearch.hppc.TestUtils.assertSortedListEquals;
import static org.junit.Assert.*;

            set.clear();

            for (int round = 0; round < size * 20; round++)
            {
                Integer key = rnd.nextInt(size);
                if (rnd.nextInt(50) == 0) {
                  key = Intrinsics.empty();
                }

                if (rnd.nextBoolean())
                {
                    if (rnd.nextBoolean()) {
                        int index = set.indexOf(cast(key));
                        if (set.indexExists(index)) {
                            set.indexReplace(index, cast(key));
                        } else {
                            set.indexInsert(index, cast(key));
                        }
                    } else {
                        set.add(cast(key));
                    }
                    other.add(cast(key));

                    assertTrue(set.contains(cast(key)));
                    assertTrue(set.indexExists(set.indexOf(cast(key))));
                }
                else
                {
                    assertEquals(other.contains(key), set.contains(cast(key)));
                    boolean removed;
                    if (set.contains(cast(key)) && rnd.nextBoolean()) {