val sortedList = allNovelList.sortedWith(compareBy { (it as Novel).no })
And
allNovelList.sortBy { (it as Novel).no }
I have a list of custom object, in which there are integer 'no' is added like id or primary key. From 0 to 9 sorting is working very fine but after 9 , 10 is below to 1.
I am working in Kotlin for Android for first time. I have looked all around the web but I could not get the proper code.
Both lines are giving same sorting. What I want, 1,2,3,....,9,10,11,12...., And What I get after sorting. 1,10,11,2,3,4,5,6...,9
It is sorting like alphabetically.
nois integer?