mirror of https://github.com/apache/lucene.git
Added equals/hashcode implementations to enable caching
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@541816 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
304884c660
commit
132c5fd899
|
@ -48,4 +48,27 @@ public class TermsFilter extends Filter
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
return true;
|
||||
if((obj == null) || (obj.getClass() != this.getClass()))
|
||||
return false;
|
||||
TermsFilter test = (TermsFilter)obj;
|
||||
return (termsList == test.termsList||
|
||||
(termsList!= null && termsList.equals(test.termsList)));
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
int hash=9;
|
||||
for (Iterator iter = termsList.iterator(); iter.hasNext();)
|
||||
{
|
||||
Term term = (Term) iter.next();
|
||||
hash = 31 * hash + term.hashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue