Commit Graph

416 Commits

Author SHA1 Message Date
Ilya Gorbunov 346ea28337 lazyOf to create already initialized lazy value. 2015-06-19 23:08:17 +03:00
Ilya Gorbunov b71fe4cd25 Lazy: Rename valueCreated property to isInitialized() function.
Notes about behavior of Lazy when initializer throws an exception.
2015-06-19 23:08:15 +03:00
Ilya Gorbunov ecd131a7a1 Lazy made serializable. 2015-06-19 23:08:14 +03:00
Ilya Gorbunov 536e669023 Provide Lazy<T> in kotlin package — an interface that represents lazily computed value. Read-only properties can be delegated to lazy with the extension getter. Delegates.lazy and blockingLazy are deprecated. 2015-06-19 23:08:09 +03:00
Ilya Gorbunov fb6c7e20de Use identity equals in lazy unescape.
#KT-7474 Fixed
2015-06-19 23:00:01 +03:00
Ilya Gorbunov a1d8e9d633 Provide dropLast and takeLastWhile methods. Optimize special cases of drop/take/dropLast/takeLast (when n is equal to zero or size of collection). 2015-06-04 16:32:25 +03:00
Ilya Gorbunov 9f85fa9720 Make proposed split replacement equivalent in behavior with additional dropLastWhile call.
#KT-7887
2015-06-04 16:32:23 +03:00
Ilya Gorbunov 9b17220baa Provide dropLastWhile for Arrays, Lists and Strings. 2015-06-04 16:32:21 +03:00
Ilya Gorbunov 13c89b7ae9 Provide lineSequence() extension method instead of BufferedReader.lines() in order not to conflict with JDK8 instance method with the same name. 2015-06-04 16:32:17 +03:00
Ilya Gorbunov 0302dd06f7 Do not call mkdirs when destination file of copyTo doesn't have any parent directory.
#KT-7888 Fixed
2015-06-02 15:50:47 +03:00
Ilya Gorbunov 1cf4a407d1 JS: Provide MIN_VALUE and MAX_VALUE member constants for Double and Float companion objects.
JVM: Make MIN_VALUE and MAX_VALUE not an extension but member constant properties of Double and Float companion objects.
2015-05-26 00:26:19 +03:00
Ilya Gorbunov 4fd1b46e91 Refactor JS tests: unified package name, test JS specific map implementations only in JS.
Add required files to build StdLibTestToJSTest.
Remove tests StdLibMapJsTest and StdLibSetJsTest because they are tested elsewhere.
2015-05-24 05:07:01 +03:00
Ilya Gorbunov c95ba4da8e Tests for specialized primitive implementations of sets and maps in JS. 2015-05-24 05:06:51 +03:00
Ilya Gorbunov ebe578dbc5 Tests to ensure the behavior of the specialized empty List, Set, Map implementations is same as of non-specialized ones. 2015-05-24 05:03:46 +03:00
Ilya Gorbunov edc471c8ec Optimize the implementation of emptyList, emptySet and emptyMap and make them serializable.
Specialized implementations of singleton List, Set and Map are used in JVM.

#KT-6682 Fixed
#KT-7104 Fixed
#KT-4840 Fixed
2015-05-24 05:03:36 +03:00
Ilya Gorbunov 33f5158170 Fix deprecated replaceAll and replaceFirst usages in stdlib tests and tools. 2015-05-22 16:13:55 +03:00
Ilya Gorbunov 6516c74a1a Revert back 2nd stage of split semantics change and restore deprecated String.split(String). 2015-05-21 23:13:16 +03:00
Ilya Gorbunov 6a3cb0eff8 Provide distinctBy(keySelector) method for collections and sequences.
Implement distinct() and toMutableSet() for sequences.
Breaking change: distinct() now returns List instead of Set.

#KT-5834 Fixed
#KT-6063 Fixed
2015-05-20 19:28:47 +03:00
Ilya Gorbunov 46d91b2606 Add test for toMap with key selector and value transform. 2015-05-20 19:28:45 +03:00
Ilya Gorbunov f18b9caa8d JS: Provide MIN_VALUE and MAX_VALUE member constants for Int, Long, Short and Byte companion objects.
JVM: Make MIN_VALUE and MAX_VALUE not an extension but member constant properties of Int, Long, Short and Byte companion objects.
2015-05-17 17:26:25 +03:00
Sergey Mashkov a11e0a84b5 JS tests for addClass, removeClass, removeFromParent 2015-05-14 09:16:56 +03:00
Sergey Mashkov 4ee780ef07 JS move document/window/storage to kotlin.browser 2015-05-14 09:16:51 +03:00
Sergey Mashkov 33c1d5d2cf JS fix tests failed due to api change 2015-05-14 09:16:50 +03:00
Ilya Gorbunov f7aa997003 Provide fast path for negative index values in elementAt.
Minor: kdoc wording.
2015-05-12 21:07:24 +03:00
Ilya Gorbunov a5ed5d4269 Generate elementAtOrNull and elementAtOrElse extension methods for iterables, collections, sequences, etc.
#KT-6952 Fixed
2015-05-12 20:08:20 +03:00
Dmitry Jemerov 2a99f757c4 replace 'trait' keyword with 'interface' in library code 2015-05-12 17:07:46 +02:00
Ilya Gorbunov 34526005d0 Provide a way to construct an empty typed array without init lambda. 2015-05-09 11:45:43 +03:00
Ilya Gorbunov d531d7130f Add an optional parameter to joinToString() and joinTo() functions: lambda function which maps the element to string.
#KT-5468 Fixed
2015-05-09 01:11:47 +03:00
Ilya Gorbunov c8a76f6344 Merge overloads String.compareToIgnoreCase and String.compareTo with an optional parameter. Provide CASE_INSENSITIVE_ORDER comparer in String.Companion. 2015-05-09 01:11:45 +03:00
Ilya Gorbunov 062d080e80 CharCategory and CharDirectionality enums for JVM. 2015-05-09 01:11:36 +03:00
Ilya Gorbunov fb5a3a771c String.split(Pattern, limit) now treats limit differently: 0 means no limit is specified, but trailing empty elements are not stripped; -1 and other negative values are not allowed. 2015-05-09 01:11:34 +03:00
Ilya Gorbunov b1255cf95b 2nd stage of split semantics change: remove deprecated String.split(String), rename splitBy back to split. 2015-05-09 01:11:32 +03:00
Ilya Gorbunov aa6bdb039b Take caution when advancing to the next match after an empty string was matched not to stuck at the same position. 2015-05-09 01:11:30 +03:00
Ilya Gorbunov 260553d516 Temporary workaround due to KT-7502.
Correct usage of joinToString.
Test for passing multiple options.
2015-05-09 01:11:28 +03:00
Ilya Gorbunov 81325208be Remove Regex() and toRegex() overloads with vararg options. Now only zero, one or set of options are allowed. 2015-05-09 01:11:26 +03:00
Ilya Gorbunov a5177b785d Add String.replaceFirst methods.
String.replaceFirst(String, String) temporary named as replaceFirstLiteral.
2015-05-09 01:11:14 +03:00
Ilya Gorbunov 157c86b9c6 Empty string is supported as a delimiter in split and as an oldValue in replace. 2015-05-09 01:11:12 +03:00
Ilya Gorbunov db13705506 Tests for match and replace. 2015-05-09 01:11:04 +03:00
Ilya Gorbunov 0b03caf3e7 Uniform implementation of String.replace and String.matches(Regex) across JVM and JS.
Deprecated String.matches(String) and String.replaceAll methods.
2015-05-09 01:11:03 +03:00
Ilya Gorbunov 01ace84070 Regex implementation: split, replace and replaceFirst. 2015-05-09 01:11:00 +03:00
Ilya Gorbunov 559c1604d7 Rename Pattern to Regex.
toRegex now converts string to our regex, and toPattern converts to JVM Pattern.
2015-05-09 01:10:59 +03:00
Ilya Gorbunov a4784dfa78 Pattern implementation for JS. 2015-05-09 01:10:57 +03:00
Ilya Gorbunov da1641e0f8 Pattern implementation: JVM and partially JS.
Common tests.
2015-05-09 01:10:55 +03:00
Ilya Gorbunov 7fba979372 Generate to[Primitive]Array() methods for generic arrays and collections.
#KT-4180 Fixed
2015-04-22 18:21:37 +03:00
Ilya Gorbunov 592e6582b3 Provide isInfinite() and isFinite() functions for Double and Float.
#KT-7126 Fixed
2015-04-22 18:21:31 +03:00
Ilya Gorbunov 5dacb5a745 Provide average() method for iterables, sequences and arrays.
#KT-3843 Fixed
2015-04-22 18:21:29 +03:00
Ilya Gorbunov ccc3646bb8 Generate coerceAtLeast, coerceAtMost and coerceIn extension functions for numbers and other Comparables. 2015-04-22 18:20:47 +03:00
Ilya Gorbunov ade69ec0e9 Provide the emptySequence() method.
sequenceOf() with no arguments is equivalent to emptySequence().
#KT-7233 Fixed
2015-04-22 17:57:26 +03:00
Ilya Gorbunov 899a01e8c2 Rename sequence() extension to asSequence() 2015-04-22 17:57:20 +03:00
Ilya Gorbunov be11394adf Rename copyToArray() to toTypedArray(). 2015-04-21 21:27:28 +03:00