Example usage for java.lang ArrayIndexOutOfBoundsException ArrayIndexOutOfBoundsException

List of usage examples for java.lang ArrayIndexOutOfBoundsException ArrayIndexOutOfBoundsException

Introduction

In this page you can find the example usage for java.lang ArrayIndexOutOfBoundsException ArrayIndexOutOfBoundsException.

Prototype

public ArrayIndexOutOfBoundsException(int index) 

Source Link

Document

Constructs a new ArrayIndexOutOfBoundsException class with an argument indicating the illegal index.

Usage

From source file:IntList.java

/** Return an element of the array */
public int get(int index) throws ArrayIndexOutOfBoundsException {
    if (index >= size)
        throw new ArrayIndexOutOfBoundsException(index);
    else//from   w ww.j  a  va  2s  .c o m
        return data[index];
}

From source file:de.micromata.genome.gwiki.utils.IntArray.java

@Override
public Integer get(int index) {
    if (index < 0 || index >= length) {
        throw new ArrayIndexOutOfBoundsException(index);
    }//from  ww w  .  jav  a 2 s  . com
    return data[index];
}

From source file:com.evolveum.midpoint.web.component.util.ListDataProvider.java

@Override
public Iterator<? extends T> internalIterator(long first, long count) {
    getAvailableData().clear();//from  www  .  ja va  2  s .c o  m

    List<T> list = model.getObject();
    if (list != null) {
        for (long i = first; i < first + count; i++) {
            if (i < 0 || i >= list.size()) {
                throw new ArrayIndexOutOfBoundsException(
                        "Trying to get item on index " + i + " but list size is " + list.size());
            }
            getAvailableData().add(list.get(WebMiscUtil.safeLongToInteger(i)));
        }
    }

    return getAvailableData().iterator();
}

From source file:IntList.java

/**
 * Gets the value in the list at the given index
 * //  ww  w . j  a  va2 s. c o  m
 * @param index
 *            The index of the value to get
 * @return The value at the given index
 */
public int get(int index) {
    if (index < 0 || index >= theSize)
        throw new ArrayIndexOutOfBoundsException(index);
    return theValue[index];
}

From source file:SerialIntList.java

/** Return an element of the array */
public int get(int index) {
    if (index >= size)
        throw new ArrayIndexOutOfBoundsException(index);
    else//from w  w  w  .j  av a2  s. c o m
        return data[index];
}

From source file:LongList.java

/**
 * Gets the value in the list at the given index
 * /* ww w .  j av a2 s  .  c o  m*/
 * @param index
 *            The index of the value to get
 * @return The value at the given index
 */
public long get(int index) {
    if (index < 0 || index >= theSize)
        throw new ArrayIndexOutOfBoundsException(index);
    return theValue[index];
}

From source file:de.micromata.genome.gwiki.utils.IntArray.java

public int getInt(int index) {
    if (index < 0 || index >= length) {
        throw new ArrayIndexOutOfBoundsException(index);
    }//w  w w . j a v  a  2 s.co m
    return data[index];
}

From source file:org.rifidi.emulator.reader.thingmagic.database.impl.DBTagID.java

@Override
public IDBRow get(int index) {
    logger.debug("Getting tag at tag memmory location " + index);
    if (suspended)
        throw new ArrayIndexOutOfBoundsException(
                "Trying to use any tag memory index while tag memory is suspended");

    return tags.get(index);
}

From source file:tilt.handler.TiltPostHandler.java

protected Double[][] coordsToArray(JSONArray cc) throws ArrayIndexOutOfBoundsException {
    Double[][] coords = new Double[4][2];
    if (cc.size() != 4)
        throw new ArrayIndexOutOfBoundsException("coordinates must be 4 points");
    for (int i = 0; i < 4; i++) {
        JSONArray vector = (JSONArray) cc.get(i);
        if (vector.size() != 2)
            throw new ArrayIndexOutOfBoundsException("Point required");
        for (int j = 0; j < 2; j++) {
            coords[i][j] = (Double) vector.get(j);
        }//w w  w.java  2s  .  co m
    }
    return coords;
}

From source file:com.evolveum.midpoint.web.component.util.ListDataProvider2.java

@Override
public Iterator<W> internalIterator(long first, long count) {

    getAvailableData().clear();//from   w w w.  j  a v  a 2s .  c  o m

    List<T> list = model.getObject();
    if (list != null) {
        for (long i = first; i < first + count; i++) {
            if (i < 0 || i >= list.size()) {
                throw new ArrayIndexOutOfBoundsException(
                        "Trying to get item on index " + i + " but list size is " + list.size());
            }
            getAvailableData().add(createObjectWrapper(list.get(WebComponentUtil.safeLongToInteger(i))));
        }
    }

    return getAvailableData().iterator();
}