Commit Graph

107 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 16b62b8e65 Introduce minWithOrNull and maxWithOrNull extension functions #KT-38854 2020-06-19 04:53:53 +03:00
Abduqodiri Qurbonzoda 194791a168 Introduce minByOrNull and maxByOrNull extension functions #KT-38854 2020-06-19 04:53:51 +03:00
Abduqodiri Qurbonzoda 846a7823ad Introduce minOrNull and maxOrNull extension functions #KT-39064 2020-06-19 04:53:49 +03:00
Ilya Gorbunov d19f9ee0c5 Simplify min/max implementation 2020-06-02 19:01:44 +03:00
Ilya Gorbunov b4ba00ca36 Document and test NaN propagation of maxOf/minOf
Also simplify minOf/maxOf implementations

#KT-38708
2020-06-02 19:01:44 +03:00
Ilya Gorbunov 7b68de38e1 Introduce minOf/maxOf, minOfWith/maxOfWith and their OrNull variants
#KT-38708 Fixed
2020-06-02 19:01:44 +03:00
Ilya Gorbunov 6a24becd1d Introduce sumOf with various selector types
#KT-11253
2020-06-02 19:01:43 +03:00
Ilya Gorbunov bdd53ee9cd Introduce new overloads of flatMap and flatMapTo
- Sequence<T>.flatMap((T) -> Iterable<R>)
- Iterable<T>.flatMap((T) -> Sequence<R>)
- Array<T>.flatMap((T) -> Sequence<R>)
- Map.flatMap((Entry) -> Sequence<R>)

KT-34506
2020-06-02 19:01:43 +03:00
Ilya Gorbunov 893021f22b Introduce runningFold and runningReduce operations
runningFold is a synonym for scan,
runningReduce replaces scanReduce.

#KT-38060
2020-04-15 23:28:07 +03:00
Abduqodiri Qurbonzoda b1fac4e721 Implement reduceIndexedOrNull and reduceRightIndexedOrNull #KT-36866 2020-03-12 18:08:55 +03:00
Abduqodiri Qurbonzoda ce8e511b79 Add setOfNotNull function #KT-35851 2020-02-18 02:33:59 +03:00
Abduqodiri Qurbonzoda ed7b8e9b85 Scan functions for Sequences and Iterable #KT-7657 2020-02-13 04:01:47 +03:00
Abduqodiri Qurbonzoda 3cad1bbb51 Create method Collection.randomOrNull() #KT-35347 2020-01-16 22:25:53 +03:00
Alfredo Delli Bovi 06008c40ab KT-33761 Add reduceRightOrNull 2019-12-26 19:27:46 +03:00
Alfredo Delli Bovi f5d696d3c4 KT-33761 Add reduceOrNull 2019-12-26 19:27:46 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Ilya Gorbunov 56672c2564 Ensure stable sorting in MutableList.sort/sortWith
MutableList.sortWith now works correctly in JS_IR backend too

#KT-12473
2019-01-17 18:38:23 +03:00
Alexander Udalov 55c8b35eee Remove unneeded default imports in stdlib and tests 2018-10-01 13:39:02 +02:00
Ilya Gorbunov ea2c33a532 Extension random() to select random element from a collection
Fixes #KT-15539
2018-08-30 16:21:27 +03:00
Ilya Gorbunov f367322084 Introduce associateWith and associateWithTo functions
#KT-13814
2018-08-30 14:58:14 +03:00
Ilya Gorbunov e21c235bbb Add or update copyrights in the standard library sources 2018-04-26 21:57:50 +03:00
Anton Bannykh fd244be9ca JS: add tests to make sure KT-22019 is fixed 2018-03-14 17:15:16 +03:00
Ilya Gorbunov c5c6eed170 Make common ArrayList declaration not open and implementing RandomAccess 2017-12-27 21:55:24 +03:00
Ilya Gorbunov 053f3b6ac0 Tests: use helper function to assert compile-time and run-time type check
To cleanup warnings about useless cast or type check that is always true.
2017-12-26 04:55:44 +03:00
Ilya Gorbunov 20b122c1dd Use kotlin.test.Test instead of org.junit.Test in common stdlib tests
(and in jvm-only and js-only tests also)
2017-10-15 17:40:53 +03:00
Marek Langiewicz 934b0b8c38 Fix List.takeLast for lists without RandomAccess 2017-05-03 16:38:15 +02:00
Ilya Gorbunov 6ae19e03d5 Clean warnings and refactor stdlib tests.
Merge RangeJVMTest into RangeTest.
2017-04-18 18:51:20 +03:00
Ilya Gorbunov 01f53d0173 Return NaN as an average of an empty collection.
#KT-15399 Fixed
2017-01-27 14:53:33 +03:00
Ilya Gorbunov 80f2efb625 joinTo/joinToString: Do not call toString on elements that are already CharSequence or Char.
#KT-15557
2017-01-13 19:49:57 +03:00
Ilya Gorbunov cdfb72ab76 Provide protected toArray implementation in AbstractCollection.
Relates to #KT-13898
2017-01-13 19:38:28 +03:00
Ilya Gorbunov 5db75c993b Introduce array-like list instantiation functions.
#KT-14935 Fixed
2016-12-30 20:00:45 +03:00
Ilya Gorbunov 6a70761783 Minor: normalize '@Test' annotation casing in all tests. 2016-11-21 18:20:33 +03:00
Ilya Gorbunov 50cd620f92 Remove java.util.* imports from common code. 2016-11-21 18:20:33 +03:00
Ilya Gorbunov 0ac461927c Minor: Fix TODOs in stdlib tests 2016-10-18 17:13:17 +03:00
Ilya Gorbunov c5a208f3eb Rearrange stdlib unit tests across packages.
Rearrange JS stdlib unit tests.
2016-06-18 16:50:32 +03:00
Ilya Gorbunov 4b533b297e reified assertFailsWith available in kotlin-test for JS
#KT-11346
2016-04-27 18:22:20 +03:00
Ilya Gorbunov 409094f0f7 Make stdlib functions dependent on reified is checks available in JS.
#KT-11346 Fixed
2016-04-27 18:22:20 +03:00
Ilya Gorbunov ab68b49a70 Introduce RandomAccess to JS.
Make EmptyList support RandomAccess.
#KT-10794
2016-03-30 21:06:18 +03:00
Ilya Gorbunov 3c35395cf7 Minor: refactor some tests to use nested classes. 2016-02-21 04:18:11 +03:00
Ilya Gorbunov 4f1418bb72 Verify index expectations for reduceIndexed/reduceRightIndexed 2016-01-31 02:45:05 +03:00
Ilya Gorbunov 1357c77d0b Minor: verify exception type of failed fold/reduce 2016-01-31 02:45:04 +03:00
Gabriel Borges d58efff974 Add foldIndexed and reduceIndexed groups of functions
- foldIndexed, foldRightIndexed, reduceIndexed and reduceRightIndexed have been added, in line with filterIndexed etc.;
- Test cases added appropriately for the new functions.
2016-01-31 02:45:02 +03:00
Ilya Gorbunov 8d02467e6d Introduce plusElement and minusElement to disambiguate situations like List<List<T>> + List<T>
#KT-9992 Fixed
2016-01-27 00:00:01 +03:00
Ilya Gorbunov 7703252239 Provide groupBy and groupByTo with keySelector and valueTransform.
Rename parameters of groupBy, add type parameter for MutableMap to groupByTo.
2016-01-25 21:15:56 +03:00
Ilya Gorbunov 67ef790abc Move comparison related functions to kotlin.comparisons, update imports in stdlib. 2016-01-18 21:46:31 +03:00
Ilya Gorbunov 055c71e8d0 Provide minWith and maxWith to find maximum and minimum values according to the given comparator.
#KT-9002 Fixed
2015-12-18 00:00:52 +03:00
Ilya Gorbunov c7d08ea599 Remove *Raw method usages from tests 2015-11-28 07:20:25 +03:00
Ilya Gorbunov 794819cea2 StdLib cleanup: make calls non-infix 2015-11-21 00:54:10 +03:00
Ilya Gorbunov 838109c302 StdLib cleanup, deprecated symbol usage: replace end with endInclusive 2015-11-21 00:54:06 +03:00
Ilya Gorbunov 07654eb82b StdLib cleanup, deprecated symbol usage: size() and length() 2015-11-21 00:54:05 +03:00