From e2a875286b8978b94cda8535333cb542759de625 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Fri, 18 May 2012 15:03:10 +0400 Subject: [PATCH] ImmutableArrayList.subList: return this if fromIndex = 0 and toIndex = length --- libraries/stdlib/src/kotlin/ImmutableArrayList.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/stdlib/src/kotlin/ImmutableArrayList.kt b/libraries/stdlib/src/kotlin/ImmutableArrayList.kt index 4cacab1b8f6..b7b9ca7c5b8 100644 --- a/libraries/stdlib/src/kotlin/ImmutableArrayList.kt +++ b/libraries/stdlib/src/kotlin/ImmutableArrayList.kt @@ -47,6 +47,9 @@ private class ImmutableArrayList( if (toIndex > length) { throw IndexOutOfBoundsException("fromIndex ($fromIndex) + toIndex ($toIndex) > length ($length)") } + if (fromIndex == 0 && toIndex == length) { + return this + } return ImmutableArrayList(array, offset + fromIndex, toIndex - fromIndex) }