Skip to content

Commit

Permalink
Drop usage of org.apache.commons.lang.builder.HashCodeBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz committed Oct 6, 2023
1 parent fa74b59 commit cc770e4
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package mobi.hsz.idea.gitignore.indexing
import com.intellij.openapi.util.Pair
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileManager
import org.apache.commons.lang.builder.HashCodeBuilder
import java.io.DataInput
import java.io.DataOutput
import java.io.IOException
Expand Down Expand Up @@ -61,9 +60,14 @@ class IgnoreEntryOccurrence(private val url: String, val items: List<Pair<String
}
}

override fun hashCode() = HashCodeBuilder().append(url).apply {
items.forEach { append(it.first).append(it.second) }
}.toHashCode()
override fun hashCode(): Int {
var result = url.hashCode()
for (item in items) {
result = 31 * result + (item.first?.hashCode() ?: 0)
result = 31 * result + (item.second?.hashCode() ?: 0)
}
return result
}

override fun equals(other: Any?) = when {
other !is IgnoreEntryOccurrence -> false
Expand Down

0 comments on commit cc770e4

Please sign in to comment.