Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
3733d0e8
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3733d0e8
编写于
10月 11, 2015
作者:
D
Denis Zharkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adjust stdlib to remove/charAt transformation
上级
89ded4ab
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
15 deletion
+15
-15
js/js.libraries/src/core/javautil.kt
js/js.libraries/src/core/javautil.kt
+2
-2
libraries/stdlib/src/kotlin/collections/MutableCollections.kt
...aries/stdlib/src/kotlin/collections/MutableCollections.kt
+9
-0
libraries/stdlib/src/kotlin/collections/ReversedViews.kt
libraries/stdlib/src/kotlin/collections/ReversedViews.kt
+1
-1
libraries/stdlib/src/kotlin/text/Strings.kt
libraries/stdlib/src/kotlin/text/Strings.kt
+0
-9
libraries/stdlib/test/collections/ReversedViewsTest.kt
libraries/stdlib/test/collections/ReversedViewsTest.kt
+3
-3
未找到文件。
js/js.libraries/src/core/javautil.kt
浏览文件 @
3733d0e8
...
...
@@ -18,7 +18,7 @@ public abstract class AbstractCollection<E>() : MutableCollection<E> {
override
fun
iterator
():
MutableIterator
<
E
>
=
noImpl
override
fun
add
(
e
:
E
):
Boolean
=
noImpl
override
fun
remove
(
o
:
Any
?
):
Boolean
=
noImpl
override
fun
remove
(
o
:
E
):
Boolean
=
noImpl
override
fun
addAll
(
c
:
Collection
<
E
>):
Boolean
=
noImpl
override
fun
containsAll
(
c
:
Collection
<
E
>):
Boolean
=
noImpl
...
...
@@ -41,7 +41,7 @@ public abstract class AbstractList<E>() : AbstractCollection<E>(), MutableList<E
override
fun
add
(
index
:
Int
,
element
:
E
):
Unit
=
noImpl
override
fun
addAll
(
index
:
Int
,
c
:
Collection
<
E
>):
Boolean
=
noImpl
override
fun
remove
(
index
:
Int
):
E
=
noImpl
override
fun
remove
At
(
index
:
Int
):
E
=
noImpl
override
fun
indexOf
(
o
:
Any
?):
Int
=
noImpl
override
fun
lastIndexOf
(
o
:
Any
?):
Int
=
noImpl
...
...
libraries/stdlib/src/kotlin/collections/MutableCollections.kt
浏览文件 @
3733d0e8
...
...
@@ -22,6 +22,15 @@ public fun <K, V> Map.Entry<K, V>.getKey(): K = key
@Deprecated
(
"Use property `value` instead"
,
ReplaceWith
(
"this.value"
))
public
fun
<
K
,
V
>
Map
.
Entry
<
K
,
V
>.
getValue
():
V
=
value
@Deprecated
(
"Use operator 'get' instead"
,
ReplaceWith
(
"this[index]"
))
public
fun
CharSequence
.
charAt
(
index
:
Int
):
Char
=
this
[
index
]
@Deprecated
(
"Use `removeAt` instead"
,
ReplaceWith
(
"this.removeAt(index)"
))
public
fun
<
E
>
MutableList
<
E
>.
remove
(
index
:
Int
):
E
=
removeAt
(
index
)
@Deprecated
(
"Use explicit cast to MutableCollection<Any?> instead"
,
ReplaceWith
(
"(this as MutableCollection<Any?>).remove(o)"
))
public
fun
<
E
>
MutableCollection
<
E
>.
remove
(
o
:
Any
?):
Boolean
=
remove
(
o
as
E
)
/**
* Adds the specified [element] to this mutable collection.
*/
...
...
libraries/stdlib/src/kotlin/collections/ReversedViews.kt
浏览文件 @
3733d0e8
...
...
@@ -30,7 +30,7 @@ private open class ReversedListReadOnly<T>(protected open val delegate: List<T>)
private
class
ReversedList
<
T
>(
protected
override
val
delegate
:
MutableList
<
T
>)
:
ReversedListReadOnly
<
T
>(
delegate
)
{
override
fun
clear
()
=
delegate
.
clear
()
override
fun
remove
(
index
:
Int
):
T
=
delegate
.
remove
(
index
.
flipIndex
())
override
fun
remove
At
(
index
:
Int
):
T
=
delegate
.
removeAt
(
index
.
flipIndex
())
override
fun
set
(
index
:
Int
,
element
:
T
):
T
=
delegate
.
set
(
index
.
flipIndex
(),
element
)
override
fun
add
(
index
:
Int
,
element
:
T
)
{
...
...
libraries/stdlib/src/kotlin/text/Strings.kt
浏览文件 @
3733d0e8
...
...
@@ -191,15 +191,6 @@ public val String.indices: IntRange
public
val
String
.
lastIndex
:
Int
get
()
=
this
.
length
()
-
1
/**
* Returns a character at the given index in a [CharSequence]. Allows to use the
* index operator for working with character sequences:
* ```
* val c = charSequence[5]
* ```
*/
public
operator
fun
CharSequence
.
get
(
index
:
Int
):
Char
=
this
.
charAt
(
index
)
/**
* Returns `true` if this CharSequence has Unicode surrogate pair at the specified [index].
*/
...
...
libraries/stdlib/test/collections/ReversedViewsTest.kt
浏览文件 @
3733d0e8
...
...
@@ -157,11 +157,11 @@ class ReversedViewsTest {
val
original
=
arrayListOf
(
1
,
2
,
3
,
4
)
val
reversed
=
original
.
asReversed
()
original
.
remove
(
3
)
original
.
remove
At
(
3
)
assertEquals
(
listOf
(
1
,
2
,
3
),
original
)
assertEquals
(
listOf
(
3
,
2
,
1
),
reversed
)
reversed
.
remove
(
2
)
reversed
.
remove
At
(
2
)
assertEquals
(
listOf
(
2
,
3
),
original
)
assertEquals
(
listOf
(
3
,
2
),
reversed
)
}
...
...
@@ -201,7 +201,7 @@ class ReversedViewsTest {
@
test
fun
testRemoveIOOB
()
{
val
success
=
try
{
arrayListOf
(
1
,
2
,
3
).
asReversed
().
remove
(
3
)
arrayListOf
(
1
,
2
,
3
).
asReversed
().
remove
At
(
3
)
true
}
catch
(
expected
:
IndexOutOfBoundsException
)
{
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录