Renamed Iterable.contains to containsItem, to avoid puzzling.
Otherwise, you could accidentally look for Double in List<Int>, or even for Int in ShortSequence (by stupid iterating).
This commit is contained in:
@@ -77,7 +77,7 @@ public fun <T> Iterable<T>.last() : T {
|
|||||||
* If collection implements [[java.util.AbstractCollection]] an overridden implementation of the contains
|
* If collection implements [[java.util.AbstractCollection]] an overridden implementation of the contains
|
||||||
* method will be used.
|
* method will be used.
|
||||||
*/
|
*/
|
||||||
public fun <T> Iterable<T>.contains(item : T) : Boolean {
|
public fun <T> Iterable<T>.containsItem(item : T) : Boolean {
|
||||||
if (this is java.util.AbstractCollection<T>) {
|
if (this is java.util.AbstractCollection<T>) {
|
||||||
return this.contains(item);
|
return this.contains(item);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user