![]() ![]() Positive value indicates receiver object is greater It is defined for all those types which are inherited from Comparable interface.To define this order for any type, it should be made an inheritor of Comparable.This can be done using compareTo() function which takes other element of same type and returns which is greater in the form of an integer value.Based on this integer values we can determine which object is greater. Char and String use the lexicographical order: p is greater than a sky is greater than air.įor user-defined type, there are different types of orders defined in Kotlin.They can be described as follows: Numeric types follow the numerical order: 1 is greater than 0 -2.8f is greater than -6f, an so on. If you take lists, two lists are never equal if they are ordered differently inspite of having same elements.In Kotlin, there are different ways of ordering the elements. There are certain collections where the order of the elements is important. ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.DevOps Engineering - Planning to Production.Python Backend Development with Django(Live).Android App Development with Kotlin(Live).Full Stack Development with React & Node JS(Live). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |