![]() * * Never equal to null: for any non-null value `x`, `x.equals(null)` should return false. * * Consistent: for any non-null values `x` and `y`, multiple invocations of `x.equals(y)` consistently return true or consistently return false, provided no information used in `equals` comparisons on the objects is modified. * * Transitive: for any non-null values `x`, `y`, and `z`, if `x.equals(y)` returns true and `y.equals(z)` returns true, then `x.equals(z)` should return true. ![]() The base keyword can be used with or without parameters. These calls are translated to static methods in jvm environments, and a special Java class is generated to hold the functions. * * Symmetric: for any non-null values `x` and `y`, `x.equals(y)` should return true if and only if `y.equals(x)` returns true. In this example, the constructor for the base class is called before the block for the constructor is executed. any type cannot hold null values in kotlin This is similar to Up-casting occurs automatically when you provide lower types of values to Any. Kotlin lets you declare functions that don’t belong to any class or object, called top-level functions. Syntax of List.any () The syntax of List.any () function with a predicate passed to it is list. So, the working of any () depends on if an argument is given to it. Implementations must fulfil the following * requirements: * * * Reflexive: for any non-null value `x`, `x.equals(x)` should return true. The Kotlin List.any (predicate) function checks if any one of element in the list matches the given predicate. ![]() ** * Indicates whether some other object is "equal to" this one. All three functions are well-known functions which can be overridden in any class.
0 Comments
Leave a Reply. |