org.snapscript.tree.collection.ArrayWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap Show documentation
Show all versions of snap Show documentation
Dynamic scripting for the JVM
package org.snapscript.tree.collection;
import java.util.AbstractList;
import java.util.RandomAccess;
import org.snapscript.core.InternalArgumentException;
public abstract class ArrayWrapper extends AbstractList implements RandomAccess {
public int length() {
return size();
}
@Override
public boolean add(T element) {
throw new InternalArgumentException("Array cannot be resized");
}
@Override
public void add(int index, T element) {
throw new InternalArgumentException("Array cannot be resized");
}
@Override
public boolean contains(Object o) {
int index = indexOf(o);
if (index == -1) {
return false;
}
return true;
}
}