Use standard emptyList()

This commit is contained in:
Ilya Ryzhenkov
2014-12-01 22:06:18 +03:00
parent fbbb7eced1
commit 9242a3d3dc
2 changed files with 4 additions and 9 deletions
@@ -1,5 +1,3 @@
fun<T> emptyList(): List<T> = listOf()
fun foo(list: List<String>){}
fun foo(list: List<String>, i: Int){}
fun foo(list: List<Int>, b: Boolean){}
+4 -7
View File
@@ -10,9 +10,6 @@ import java.lang.IndexOutOfBoundsException
// Properties
private fun emptyElementList(): List<Element> = Collections.emptyList<Element>()
private fun emptyNodeList(): List<Node> = Collections.emptyList<Node>()
public var Node.text: String
get() {
return textContent
@@ -122,7 +119,7 @@ public fun Document?.elements(namespaceUri: String, localName: String): List<Ele
public fun NodeList?.toList(): List<Node> {
return if (this == null) {
// TODO the following is easier to convert to JS
emptyNodeList()
emptyList()
}
else {
NodeListAsList(this)
@@ -154,13 +151,13 @@ public fun Document?.get(selector: String): List<Element> {
return if (element != null)
arrayListOf(element)
else
emptyElementList()
emptyList()
} else {
// assume its a vanilla element name
elements(selector)
}
} else {
emptyElementList()
emptyList()
}
}
@@ -175,7 +172,7 @@ public fun Element.get(selector: String): List<Element> {
return if (element != null)
arrayListOf(element)
else
emptyElementList()
emptyList()
} else {
// assume its a vanilla element name
elements(selector)