Is there any Java/Kotlin library like <https://dev...
# getting-started
a
Is there any Java/Kotlin library like https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil which can be used for Kotlin (non-Android) project? I need it to find differences between two lists with custom comparator.
m
It looks like the source code for
DiffUtil
is pretty self-contained and it's Apache license. It's Java, but you could try copying-and-pasting it into a .kt file in IntelliJ Idea or Android Studio. The automatic Java-to-Kotlin conversion may give you something usable in pure kotlin.
k
Just doing a search on the internet brings up a few possibilities, such as https://github.com/andrewbailey/Difference. I haven't used any of them myself.
r
m
@Robert Jaros Isn't that a text diff library? I think the OP is looking for a list difference that produces edit operations (add/delete/move) for animating updates to UI.
r
It does support diffing lists as well
m
Oh, very cool!