// Path: unsafe-helper/src/main/java/net/bramp/unsafe/Preconditions.java
// public static void checkArgument(boolean expression,
//     @Nullable String errorMessageTemplate,
//     @Nullable Object... errorMessageArgs) {
//   if (!expression) {
//     throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
//   }
// }
// 
// Path: unsafe-helper/src/main/java/net/bramp/unsafe/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }


import com.google.common.base.Throwables;
import sun.misc.Unsafe;
import java.util.AbstractList;
import java.util.Collection;
import java.util.RandomAccess;
import static net.bramp.unsafe.Preconditions.checkArgument;
import static net.bramp.unsafe.Preconditions.checkNotNull;
  @Override public T get(int index) {
    try {
      return get(newInstance(), index);
    } catch (InstantiationException e) {
      throw Throwables.propagate(e);
    }
  }

  private long offset(int index) {
    return base + index * elementSpacing;
  }

  /**
   * Copies the element at index into dest
   *
   * @param dest  The destination object
   * @param index The index of the object to get
   * @return The fetched object
   */
  public T get(T dest, int index) {
    checkBounds(index);
    // We would rather do
    //   UnsafeHelper.copyMemory(null, offset(index), dest, firstFieldOffset, elementSize);
    // but this is unsupported by the Unsafe class
    copier.copy(dest, offset(index));
    return dest;
  }

  @Override public T set(int index, T element) {
    checkBounds(index);
// Path: unsafe-helper/src/main/java/net/bramp/unsafe/Preconditions.java
// public static void checkArgument(boolean expression,
//     @Nullable String errorMessageTemplate,
//     @Nullable Object... errorMessageArgs) {
//   if (!expression) {
//     throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
//   }
// }
// 
// Path: unsafe-helper/src/main/java/net/bramp/unsafe/Preconditions.java
// public static <T> T checkNotNull(T reference) {
//   if (reference == null) {
//     throw new NullPointerException();
//   }
//   return reference;
// }


// Path: unsafe-collection/src/main/java/net/bramp/unsafe/UnsafeArrayList.java
import com.google.common.base.Throwables;
import sun.misc.Unsafe;
import java.util.AbstractList;
import java.util.Collection;
import java.util.RandomAccess;
import static net.bramp.unsafe.Preconditions.checkArgument;
import static net.bramp.unsafe.Preconditions.checkNotNull;

  @Override public T get(int index) {
    try {
      return get(newInstance(), index);
    } catch (InstantiationException e) {
      throw Throwables.propagate(e);
    }
  }

  private long offset(int index) {
    return base + index * elementSpacing;
  }

  /**
   * Copies the element at index into dest
   *
   * @param dest  The destination object
   * @param index The index of the object to get
   * @return The fetched object
   */
  public T get(T dest, int index) {
    checkBounds(index);
    // We would rather do
    //   UnsafeHelper.copyMemory(null, offset(index), dest, firstFieldOffset, elementSize);
    // but this is unsupported by the Unsafe class
    copier.copy(dest, offset(index));
    return dest;
  }

  @Override public T set(int index, T element) {
    checkBounds(index);
    checkNotNull(element);