Behavior of "remove(object)" on ToManyList

From: Alexander Lamb (alam..ac.com)
Date: Thu May 24 2007 - 03:54:46 EDT

  • Next message: Andrus Adamchik: "Re: Behavior of "remove(object)" on ToManyList"

    Hello list,

    I am fetching a "List" of objects (a too many relationship).

    Then in a loop, I am removing some objects:

              List<RegistryCenter> rcs = getRegistry().getRegistryCenters();
              List centers = getSelectedCountry().getCenters();
              for(RegistryCenter rc:rcs)
                {
                    centers.remove(rc.getCenter());
                }

    Now, this doesn't always work. Actually, it fails if "centers" is a fault (I checked in the Cayenne code).

    If I simply do a "size()" of "contains" on the list before my loop for example. My list will fire and my loop will function correctly, removing objects when present in the list.

    So there is a workaround, but I was wondering why the "remove(object)" in ToManyList.java behaved differently than for example "remove(index)" which will correctly fire the fault.

    In other words, "remove(object)" is the only function which does not systématically fire the fault.

    Why?

    Thanks,

    Alex



    This archive was generated by hypermail 2.0.0 : Thu May 24 2007 - 03:55:15 EDT