Stdlib: Deprecated.kt splitted to common and jvm parts.

This commit is contained in:
Zalim Bashorov
2014-09-15 22:43:37 +04:00
parent 3bc80a6d05
commit 0cac7c32b6
2 changed files with 39 additions and 20 deletions
-20
View File
@@ -1,7 +1,6 @@
package kotlin
import java.util.*
import java.util.concurrent.Callable
deprecated("Use firstOrNull function instead.")
public inline fun <T> Array<out T>.find(predicate: (T) -> Boolean): T? = firstOrNull(predicate)
@@ -21,28 +20,9 @@ public fun <K, V> hashMap(vararg values: Pair<K, V>): HashMap<K, V> = hashMapOf(
deprecated("Use listOf(...) or linkedListOf(...) instead")
public fun linkedList<T>(vararg values: T): LinkedList<T> = linkedListOf(*values)
deprecated("Use sortedSetOf(...) instead")
public fun sortedSet<T>(vararg values: T): TreeSet<T> = sortedSetOf(*values)
deprecated("Use sortedSetOf(...) instead")
public fun sortedSet<T>(comparator: Comparator<T>, vararg values: T): TreeSet<T> = sortedSetOf(comparator, *values)
deprecated("Use sortedMapOf(...) instead")
public fun <K, V> sortedMap(vararg values: Pair<K, V>): SortedMap<K, V> = sortedMapOf(*values)
deprecated("Use linkedMapOf(...) instead")
public fun <K, V> linkedMap(vararg values: Pair<K, V>): LinkedHashMap<K, V> = linkedMapOf(*values)
/**
* A helper method for creating a [[Callable]] from a function
*/
deprecated("Use SAM constructor: Callable(...)")
public /*inline*/ fun <T> callable(action: () -> T): Callable<T> {
return object: Callable<T> {
public override fun call() = action()
}
}
/**
* A helper method for creating a [[Runnable]] from a function
*/
@@ -0,0 +1,39 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package kotlin
import java.util.*
import java.util.concurrent.Callable
deprecated("Use sortedSetOf(...) instead")
public fun sortedSet<T>(vararg values: T): TreeSet<T> = sortedSetOf(*values)
deprecated("Use sortedSetOf(...) instead")
public fun sortedSet<T>(comparator: Comparator<T>, vararg values: T): TreeSet<T> = sortedSetOf(comparator, *values)
deprecated("Use sortedMapOf(...) instead")
public fun <K, V> sortedMap(vararg values: Pair<K, V>): SortedMap<K, V> = sortedMapOf(*values)
/**
* A helper method for creating a [[Callable]] from a function
*/
deprecated("Use SAM constructor: Callable(...)")
public /*inline*/ fun <T> callable(action: () -> T): Callable<T> {
return object: Callable<T> {
public override fun call() = action()
}
}