Code example for CursorIndexOutOfBoundsException

0
    public T getGraphObject() { 
        if (pos < 0) {
            throw new CursorIndexOutOfBoundsException("Before first object.");
        } 
        if (pos >= graphObjects.size()) {
            throw new CursorIndexOutOfBoundsException("After last object.");
        } 
        return graphObjects.get(pos);
    } 
 
    @Override 
    public void close() { 
        closed = true;
    } 
 
    @Override 
    public boolean isClosed() { 
        return closed;
    } 
 
}