Well, I wouldn't use an ArrayList -- a HashMap is more appropriate.
With a HashMap, you get trivial access to the user's jobhistory via
get("userA") and put("userA", ...) methods.
Wayne
On Wed, Sep 10, 2008 at 2:43 PM, amiller <[EMAIL PROTECTED]> wrote:
>
> So how would I check the values ArrayList for having seen the user
> before?
> Would that look like this:
>
> for ( int i = 0; i < values.size(); i++) {
> if ( ((JobHistory)values[i]).name.compareTo(username) == 0 )
> // seen before, set jobcount for month
> setJobCount(i, n, jobcount);
> } else {
> // new entry
> addNewUser(username, n, jobcount);
> }
> }
>
> No this is't a homework assigmnet.
> I'm not a programmer, just a unix admin trying to learn java.
>
> Thanks
>
> Alan
>
> On Sep 10, 10:40 pm, Christian Catchpole <[EMAIL PROTECTED]>
> wrote:
>> having 12 ints for the months of the year is not a very flexible
>> design. As you have found, you need 12 case statements to "hard code"
>> the conditions. Imagine now doing that with days of the year. As
>> Wayne says, perhaps a setJobcount(int month, int count) method.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---