{
if (formValidators instanceof IFormValidator)
{
if (index == 0)
{
final IFormValidator removed = (IFormValidator)formValidators;
formValidators = null;
return removed;
}
else
{
throw new IndexOutOfBoundsException();
}
}
else
{
final IFormValidator[] validators = (IFormValidator[])formValidators;
final IFormValidator removed = validators[index];
// check if we can collapse array of 1 element into a single object
if (validators.length == 2)
{
formValidators = validators[1 - index];
}