directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <>
Subject Re: equals() implementation in ProtectedItem
Date Fri, 21 May 2010 06:45:16 GMT
Felix Knecht schrieb:
> 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]?
> Is this wanted?

I don't think that is wanted.

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.


Kind Regards,

> Felix
> [1]
> [2]

View raw message