mirror of https://github.com/apache/maven.git
add equals/hashcode for dependency
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e25114e87f
commit
5d4897ddba
|
@ -845,6 +845,40 @@
|
|||
{
|
||||
return getProperties().getProperty( property );
|
||||
}
|
||||
|
||||
public boolean equals( Object o )
|
||||
{
|
||||
if ( o == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( getClass() != o.getClass() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( getId() != null )
|
||||
{
|
||||
return getId().equals( ( (Dependency) o ).getId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( (Dependency) o ).getId() == null;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
if ( getId() != null )
|
||||
{
|
||||
return getId().hashCode();
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</codeSegment>
|
||||
</codeSegments>
|
||||
|
|
Loading…
Reference in New Issue