Drop deprecations: functions that were converted to properties.

This commit is contained in:
Ilya Gorbunov
2016-01-16 18:03:21 +03:00
parent 2813840769
commit 768a23f7eb
11 changed files with 14 additions and 179 deletions
+4 -4
View File
@@ -17,16 +17,16 @@
package java.util
public fun <E> HashSet(c: Collection<E>): HashSet<E>
= HashSet<E>(c.size()).apply { addAll(c) }
= HashSet<E>(c.size).apply { addAll(c) }
public fun <E> LinkedHashSet(c: Collection<E>): HashSet<E>
= LinkedHashSet<E>(c.size()).apply { addAll(c) }
= LinkedHashSet<E>(c.size).apply { addAll(c) }
public fun <K, V> HashMap(m: Map<K, V>): HashMap<K, V>
= HashMap<K, V>(m.size()).apply { putAll(m) }
= HashMap<K, V>(m.size).apply { putAll(m) }
public fun <K, V> LinkedHashMap(m: Map<K, V>): LinkedHashMap<K, V>
= LinkedHashMap<K, V>(m.size()).apply { putAll(m) }
= LinkedHashMap<K, V>(m.size).apply { putAll(m) }
public fun <E> ArrayList(c: Collection<E>): ArrayList<E>
= ArrayList<E>().apply { asDynamic().array = c.toTypedArray<Any?>() } // black dynamic magic
@@ -16,7 +16,7 @@ public object Collections {
@Deprecated("Use list.reverse() instead.", ReplaceWith("list.reverse()"))
public fun <T> reverse(list: MutableList<T>): Unit {
val size = list.size()
val size = list.size
for (i in 0..(size / 2) - 1) {
val i2 = size - i - 1
val tmp = list[i]
+1 -1
View File
@@ -180,7 +180,7 @@ internal fun arrayCopyResize(source: dynamic, newSize: Int, defaultValue: Any?):
internal fun <T> arrayPlusCollection(array: dynamic, collection: Collection<T>): dynamic {
val result = array.slice(0)
result.length += collection.size()
result.length += collection.size
var index: Int = array.length
for (element in collection) result[index++] = element
return result
+3 -3
View File
@@ -56,7 +56,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
public fun matches(input: CharSequence): Boolean {
nativePattern.reset()
val match = nativePattern.exec(input.toString())
return match != null && (match as RegExpMatch).index == 0 && nativePattern.lastIndex == input.length()
return match != null && (match as RegExpMatch).index == 0 && nativePattern.lastIndex == input.length
}
/** Indicates whether the regular expression can find at least one match in the specified [input]. */
@@ -114,7 +114,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
if (match == null) return input.toString()
var lastStart = 0
val length = input.length()
val length = input.length
val sb = StringBuilder(length)
do {
val foundMatch = match!!
@@ -156,7 +156,7 @@ public class Regex(pattern: String, options: Set<RegexOption>) {
result.add(input.subSequence(lastStart, match.range.start).toString())
lastStart = match.range.endInclusive + 1
}
result.add(input.subSequence(lastStart, input.length()).toString())
result.add(input.subSequence(lastStart, input.length).toString())
return result
}
+5 -5
View File
@@ -12,7 +12,7 @@ public fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boole
if (!ignoreCase)
return nativeStartsWith(prefix, 0)
else
return regionMatches(0, prefix, 0, prefix.length(), ignoreCase)
return regionMatches(0, prefix, 0, prefix.length, ignoreCase)
}
/**
@@ -22,7 +22,7 @@ public fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolea
if (!ignoreCase)
return nativeStartsWith(prefix, startIndex)
else
return regionMatches(startIndex, prefix, 0, prefix.length(), ignoreCase)
return regionMatches(startIndex, prefix, 0, prefix.length, ignoreCase)
}
/**
@@ -32,17 +32,17 @@ public fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean
if (!ignoreCase)
return nativeEndsWith(suffix)
else
return regionMatches(length() - suffix.length(), suffix, 0, suffix.length(), ignoreCase)
return regionMatches(length - suffix.length, suffix, 0, suffix.length, ignoreCase)
}
public inline fun String.matches(regex : String) : Boolean {
val result = this.match(regex)
return result != null && result.size() > 0
return result != null && result.size > 0
}
public fun CharSequence.isBlank(): Boolean = length() == 0 || (if (this is String) this else this.toString()).matches("^[\\s\\xA0]+$")
public fun CharSequence.isBlank(): Boolean = length == 0 || (if (this is String) this else this.toString()).matches("^[\\s\\xA0]+$")
public fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean =
if (this == null)