Doug Cutting wrote:
Bernhard Messer wrote:
Therefore i would like to propose two changes:
1) we should store the extension in a hash and not in String[] to
have a faster lookup
Do you mean to use something like:
String lastDot = name.lastIndexOf('.');
if (lastDot >= 0) {
String nameExt = name.substring(lastDot+1, name.length());
if (FILENAME_EXTENSIONS.get(nameExt)) {
...
}
}
That would allocate a new String in each case, which would be
substantially faster. Is that what you meant?
exactly, that's what i had in mind. I know that we have to allocate a
new string object for every call, but this must be much cheaper than the
current implementation which has to walk thru the whole array every time
the method is called.
Bernhard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]