Created
May 19, 2017 14:07
-
-
Save ChanSek/d2ff00bf1332c0384f8c1f58e2b7ce45 to your computer and use it in GitHub Desktop.
User class after migrated to Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User { | |
var userId: String? = null | |
var email: String? = null | |
var userName: String? = null | |
var name: String? = null | |
var phNumber: String? = null | |
var country: String? = null | |
var profilePic: String? = null | |
override fun equals(o: Any?): Boolean { | |
if (this === o) return true | |
if (o == null || javaClass != o.javaClass) return false | |
val that = o as UserSample? | |
if (if (userId != null) userId != that!!.userId else that!!.userId != null) return false | |
if (if (email != null) email != that.email else that.email != null) return false | |
if (if (userName != null) userName != that.userName else that.userName != null) | |
return false | |
if (if (name != null) name != that.name else that.name != null) return false | |
if (if (phNumber != null) phNumber != that.phNumber else that.phNumber != null) | |
return false | |
if (if (country != null) country != that.country else that.country != null) return false | |
return if (profilePic != null) profilePic == that.profilePic else that.profilePic == null | |
} | |
override fun hashCode(): Int { | |
var result = if (userId != null) userId!!.hashCode() else 0 | |
result = 31 * result + if (email != null) email!!.hashCode() else 0 | |
result = 31 * result + if (userName != null) userName!!.hashCode() else 0 | |
result = 31 * result + if (name != null) name!!.hashCode() else 0 | |
result = 31 * result + if (phNumber != null) phNumber!!.hashCode() else 0 | |
result = 31 * result + if (country != null) country!!.hashCode() else 0 | |
result = 31 * result + if (profilePic != null) profilePic!!.hashCode() else 0 | |
return result | |
} | |
override fun toString(): String { | |
return "UserSample{" + | |
"userId='" + userId + '\'' + | |
", email='" + email + '\'' + | |
", userName='" + userName + '\'' + | |
", name='" + name + '\'' + | |
", phNumber='" + phNumber + '\'' + | |
", country='" + country + '\'' + | |
", profilePic='" + profilePic + '\'' + | |
'}' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment