A small Java pet peeve
Why does the Vector class throw an ArrayIndexOutOfBoundsException when all other List interface implementors throw IndexOutOfBoundsException? Doesn't this somewhat defeat the purpose of encapsulation, since by throwing ArrayIndexOutOfBoundsException, the Vector class is exposing it's internal implementation?? The ArrayList is also based on an array data structure....but it doesn't hint it by throwing the more specific exception. Why can't they deprecate the method and throw the correct exception?
In my humble opinion, no object should throw ArrayIndexOutOfBoundsException because this exception implies the use of an array not the use of an Object.
Sorry for my ranting on such a small insignificant subject....Oh well....What do you think??
5:53:40 PM
|