Stefan Seelmann schrieb: > Felix Knecht wrote: >>>> Are you aware, that this [1] is an equal of collections and will return >>>> in most cases "false" as it is a reference comparison [2]? >> Thanks to test cases :) >>> I checked the history. Previously we didn't use >>> Collections.unmodifiableCollection( attributeTypes ) >>> And a quick check shows that the callers of the construtor always pass >>> an java.util.Set. >>> For two Sets the equals method would work correctly, but the creation of >>> the unmodifyalbe collection not. >>> I think we have two options: >>> - use CollectionUtils.isEqualCollection() from commons collections, this >>> seems to do the right thing. >>> - try to change the parameter type from Collection to Set in the >>> constructors and use Collections.unmodifiableSet() instead. >>> Thoughts? >> It dependes on the content we have in the collections. Set doesn't >> allows duplicates wheras with certain collection implementations this is >> possible. >> > > I checked X.501 specification [1], Annex E, page 173. It clearly states > that in ProtectedItem all elments (attributeType, allAttributeValues, > attributeValue, selfValue, maxValueCount, restrictedBy) are *sets*. > > I'm going to change all Collection types to Sets and activate your tests.
Done. Thanks Felix for the test cases :-) Kind Regards, Stefan
