All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.tree.collection.ArrayWrapper Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
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;

   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy