commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack, Paul" <>
Subject RE: [collection] Collections for primitives
Date Tue, 25 Jun 2002 17:15:46 GMT
> I'm still curious what the use-case is for a situation that would 
> require non-"fail-fast" collections.  I understand the theory, I just 
> want to hear how it would be used in practice.

A website allows a user to quickly look up their account information
by entering their userId, which is always an Integer, and then clicking

The servlet that handles that request uses a Map that maps Integers to
account information.

If the user incorrectly enters their user id, the containsKey(userId) call
returns false, regardless of whether the userId has a syntax
error or if it doesn't exist in the map.  When it returns false, the 
user is prompted to re-enter the information. 

A bit more straightforward then both checking for a false result AND
catching an exception.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message