Skip to content

Releases: passsy/kt.dart

0.4.1

09 Jan 16:55
Compare
Choose a tag to compare

diff v0.4.0...v0.4.1

Improve Readme to render correctly on pub.

0.4.0

09 Jan 16:54
Compare
Choose a tag to compare

diff v0.3.0...v0.4.0

The kollection project was migrated to kotlin.dart where kollection becomes the collection module.

Upgrade

pubspec.yaml

dependencies:
-  dart_kollection: ^0.3.0
+  kotlin_dart: ^0.4.0

your_source.dart

- import 'package:dart_kollection/dart_kollection.dart';
+ import 'package:kotlin_dart/kotlin.dart';

Breaking Changes

  • #64 The class prefix of all collections has been changed from K to Kt (KList -> KtList)
  • #60 listOf now accepts up to 10 non-null arguments instead of an Iterable. Use listFrom to create KtLists from an dart Iterables
  • #60 Collections can now be created with factory constructors i.e. KtList.of(1, 2 ,3). Both APIs, factory constructor and function based one, are equally supported. It only depends on your personal taste.

Here is a list of all collection creation APIs.

Kotlin like, function based syntax

  /// List
  // Create immutable lists
  emptyList<int>();
  listOf(1, 2, 3, 4, 5);
  listFrom([1, 2, 3, 4, 5]);
  // Create mutable lists
  mutableListOf(1, 2, 3, 4, 5);
  mutableListFrom([1, 2, 3, 4, 5]);
  
  /// Set
  // Create immutable sets
  emptySet<int>();
  setOf(1, 2, 3, 4, 5);
  setFrom([1, 2, 3, 4, 5]);
  // Create a mutable set which keeps the order of the items
  linkedSetOf(1, 2, 3, 4, 5);
  linkedSetFrom([1, 2, 3, 4, 5]);
  // Create mutable, unordered hash-table based set
  hashSetOf(1, 2, 3, 4, 5);
  hashSetFrom([1, 2, 3, 4, 5]);
  
  /// Map
  // Create immutable maps
  emptyMap<int, String>();
  mapFrom({1: "a", 2: "b"});
  // Create mutable maps
  mutableMapFrom({1: "a", 2: "b"});
  // Create mutable maps without specified order when iterating over items
  hashMapFrom({1: "a", 2: "b"});
  // Create mutable maps which keep the order of the items
  linkedMapFrom({1: "a", 2: "b"});

Dart like, constructor based syntax

  /// List
  // Create immutable lists
  KList<int>.empty();
  KList.of(1, 2, 3, 4, 5);
  KList.from([1, 2, 3, 4, 5]);
  // Create mutable lists
  KMutableList<int>.empty();
  KMutableList.of(1, 2, 3, 4, 5);
  KMutableList.from([1, 2, 3, 4, 5]);
  
  /// Set
  // Create immutable sets
  KSet<int>.empty();
  KSet.of(1, 2, 3, 4, 5);
  KSet.from([1, 2, 3, 4, 5]);
  // Create a mutable set which keeps the order of the items
  KMutableSet<int>.empty();
  KMutableSet.of(1, 2, 3, 4, 5);
  KMutableSet.from([1, 2, 3, 4, 5]);
  // Create mutable, unordered hash-table based set
  KHashSet<int>.empty();
  KHashSet.of(1, 2, 3, 4, 5);
  KHashSet.from([1, 2, 3, 4, 5]);
  // Create a mutable set which keeps the order of the items
  KLinkedSet<int>.empty();
  KLinkedSet.of(1, 2, 3, 4, 5);
  KLinkedSet.from([1, 2, 3, 4, 5]);
  
  /// Map
  // Create mutable maps
  KMutableMap<int, String>.empty();
  KMutableMap.from({1: "a", 2: "b"});
  // Create mutable maps without specified order when iterating over items
  KHashMap<int, String>.empty();
  KHashMap.from({1: "a", 2: "b"});
  // Create mutable maps which keep the order of the items
  KLinkedMap<int, String>.empty();
  KLinkedMap.from({1: "a", 2: "b"});

0.3.1

09 Jan 16:54
Compare
Choose a tag to compare

diff v0.3.0...v0.3.1

Deprecate all APIs and advise users to upgrade to kotlin.dart

0.3.0

03 Jan 17:26
Compare
Choose a tag to compare

diff v0.2.0...v0.3.0

Summary

This release of Kollection fully covers the project with unit tests, from 52% to 99% 🎉.
By doing that bugs where discovered and fixed.

Because Dart doesn't support non-nullable types yet, this update manually checks all method arguments at runtime.
Passing null in any method will throw ArgumentError unless documented otherwise.

Behavior changes

  • #36 All method arguments are now validated for nullability. If a argument isn't documented as "nullable" the method will throw ArgumentError (when asserts are enabled)
  • #51, #46 KIterable<T>.associateWithTo, Kiterable<T>.filterTo, KIterable<T>.filterIndexedTo, KIterable<T>.filterNotTo, KIterable<T>.filterNotNullTo , KIterable<T>.groupByTo ,KMap<T>.mapKeysTo ,KMap<T>.mapValuesTo, KIterable.toCollection did not compile when called directly due to dart-lang/sdk/issues/35518. The type of destination of those methods has been changed to a dynamic type (i.e. KMutableList<T> -> KMutableList<dynamic>). Those methods will now be checked at runtime. This has one advantage: It allows to pass in contravariant types.
final KIterable<int> iterable = listOf([4, 25, -12, 10]);
final result = mutableListOf<num>(); // covariant!
final filtered = iterable.filterIndexedTo(result, (i, it) => it < 10);
expect(identical(result, filtered), isTrue);
expect(result, listOf([4, -12]));
  • #56 KMutableEntry.setValue now throws UnimplementedError because of bug #55. It anyways never worked.
  • #58 KSet doesn't allow mutation of its elements with via set getter. It is now really immutable.

API changes

Bug fixes

Documentation changes

  • #57 Document hashSetOf and linkedSetOf
  • #19 KIterable.any document return value when called without predicate
  • #51 Document expected type of now dynamically typed KIterable<T>.associateWithTo, Kiterable<T>.filterTo, KIterable<T>.filterIndexedTo, KIterable<T>.filterNotTo, KIterable<T>.filterNotNullTo , KIterable<T>.groupByTo ,KMap<T>.mapKeysTo ,KMap<T>.mapValuesTo, KIterable.toCollection

Other changes

Read more

v0.2.0

03 Dec 19:30
Compare
Choose a tag to compare

Changelog

diff v0.1.0...v0.2.0

Behavior change

  • #6 Breaking: KMutableIterator.remove now throws UnimplementedError because of bug #5

API changes

  • #1 Add Set<T> get set returning the internal dart set
  • #1 Add Map<K, V> get map returning the intenral dart set
  • #7 Add KMap.toMap and KMap.toMutableMap
  • #8 Add KMap.isNotEmpty
  • 3e3228e Add KMap.toString()
  • #9 Add Map.plus, Map.minus and operator +(KMap<K, V> map), operator -(K key)
  • #12 Remove const constructors from collection interfaces
  • #13 Remove default implementations from collection interfaces

Documentation changes

  • #15 Add documentation for compareBy and compareByDescending

Other changes

  • #2 Travis CI #2
  • #3, #4 Code coverage
  • #10 Test KMutableList.fill
  • #11 Test KPair, KTriple
  • #14 Test Exceptions
  • #15 Test Comparators naturalOrder(), reverseOrder()
  • #15 Test reverse(Comparator) util function
  • 6dd0d85 Reformatted with dartfmt (80 chars)

0.1.0

28 Nov 16:45
Compare
Choose a tag to compare

Initial release for

  • KList/KMutableList
  • KSet/KMutableSet
  • KMap/KMutableMap

with tons of extensions waiting for you to use them!