Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Created May 15, 2018 20:51
Show Gist options
  • Save adrianhall/07d523b9f3c1fb816ca3119627efdc4e to your computer and use it in GitHub Desktop.
Save adrianhall/07d523b9f3c1fb816ca3119627efdc4e to your computer and use it in GitHub Desktop.
data class Note(val noteId: String = UUID.randomUUID().toString()) {
companion object {
val DiffCallback = object : DiffUtil.ItemCallback<Note>() {
override fun areItemsTheSame(oldItem: Note?, newItem: Note?): Boolean
= oldItem != null && newItem != null && oldItem.noteId == newItem.noteId
override fun areContentsTheSame(oldItem: Note?, newItem: Note?): Boolean
= oldItem != null && newItem != null
&& oldItem.noteId == newItem.noteId
&& oldItem.title == newItem.title
&& oldItem.content == newItem.content
}
}
var title: String = ""
var content: String = ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment