collection 1.11.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 73

Contains utility functions and classes in the style of dart:collection to make working with collections easier.

Algorithms

The package contains functions that operate on lists.

It contains ways to shuffle a List, do binary search on a sorted List, and various sorting algorithms.

Equality

The package provides a way to specify the equality of elements and collections.

Collections in Dart have no inherent equality. Two sets are not equal, even if they contain exactly the same objects as elements.

The Equality interface provides a way to say define such an equality. In this case, for example, const SetEquality(const IdentityEquality()) is an equality that considers two sets equal exactly if they contain identical elements.

Equalities are provided for Iterables, Lists, Sets, and Maps, as well as combinations of these, such as:

const MapEquality(const IdentityEquality(), const ListEquality());

This equality considers maps equal if they have identical keys, and the corresponding values are lists with equal (operator==) values.

Iterable Zip

Utilities for "zipping" a list of iterables into an iterable of lists.

Priority Queue

An interface and implementation of a priority queue.

Wrappers

The package contains classes that "wrap" a collection.

A wrapper class contains an object of the same type, and it forwards all methods to the wrapped object.

Wrapper classes can be used in various ways, for example to restrict the type of an object to that of a supertype, or to change the behavior of selected functions on an existing object.

Features and bugs

Please file feature requests and bugs at the issue tracker.

1.11.0

  • Add EqualityMap and EqualitySet classes which use Equality objects for key and element equality, respectively.

1.10.1

  • Set.difference now takes a Set<Object> as argument.

1.9.1

  • Fix some documentation bugs.

1.9.0

  • Add a top-level stronglyConnectedComponents() function that returns the strongly connected components in a directed graph.

1.8.0

  • Add a top-level mapMap() function that works like Iterable.map() on a Map.

  • Add a top-level mergeMaps() function that creates a new map with the combined contents of two existing maps.

  • Add a top-level groupBy() function that converts an Iterable to a Map by grouping its elements using a function.

  • Add top-level minBy() and maxBy() functions that return the minimum and maximum values in an Iterable, respectively, ordered by a derived value.

  • Add a top-level transitiveClosure() function that returns the transitive closure of a directed graph.

1.7.0

  • Add a const UnmodifiableSetView.empty() constructor.

1.6.0

  • Add a UnionSet class that provides a view of the union of a set of sets.

  • Add a UnionSetController class that provides a convenient way to manage the contents of a UnionSet.

  • Fix another incorrectly-declared generic type.

1.5.1

  • Fix an incorrectly-declared generic type.

1.5.0

  • Add DelegatingIterable.typed(), DelegatingList.typed(), DelegatingSet.typed(), DelegatingMap.typed(), and DelegatingQueue.typed() static methods. These wrap untyped instances of these classes with the correct type parameter, and assert the types of values as they're accessed.

  • Fix the types for binarySearch() and lowerBound() so they no longer require all arguments to be comparable.

  • Add generic annotations to insertionSort() and mergeSort().

1.4.1

  • Fix all strong mode warnings.

1.4.0

  • Add a new PriorityQueue() constructor that forwards to new HeapPriorityQueue().

  • Deprecate top-level libraries other than package:collection/collection.dart, which exports these libraries' interfaces.

1.3.0

  • Add lowerBound to binary search for values that might not be present.

  • Verify that the is valid for CanonicalMap.[].

1.2.0

  • Add string comparators that ignore ASCII case and sort numbers numerically.

1.1.3

  • Fix type inconsistencies with Map and Set.

1.1.2

  • Export UnmodifiableMapView from the Dart core libraries.

1.1.1

  • Bug-fix for signatures of isValidKey arguments of CanonicalizedMap.

1.1.0

  • Add a QueueList class that implements both Queue and List.

0.9.4

  • Add a CanonicalizedMap class that canonicalizes its keys to provide a custom equality relation.

0.9.3+1

  • Fix all analyzer hints.

0.9.3

  • Add a MapKeySet class that exposes an unmodifiable Set view of a Map's keys.

  • Add a MapValueSet class that takes a function from values to keys and uses it to expose a Set view of a Map's values.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  collection: "^1.11.0"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:collection/collection.dart';
  
Version Uploaded Documentation Archive
1.14.10 Jun 12, 2018 Go to the documentation of collection 1.14.10 Download collection 1.14.10 archive
1.14.9 Mar 20, 2018 Go to the documentation of collection 1.14.9 Download collection 1.14.9 archive
1.14.7 Mar 13, 2018 Go to the documentation of collection 1.14.7 Download collection 1.14.7 archive
1.14.6 Mar 6, 2018 Go to the documentation of collection 1.14.6 Download collection 1.14.6 archive
1.14.5 Jan 3, 2018 Go to the documentation of collection 1.14.5 Download collection 1.14.5 archive
1.14.4 Jan 3, 2018 Go to the documentation of collection 1.14.4 Download collection 1.14.4 archive
1.14.3 Jul 20, 2017 Go to the documentation of collection 1.14.3 Download collection 1.14.3 archive
1.14.2 Jul 7, 2017 Go to the documentation of collection 1.14.2 Download collection 1.14.2 archive
1.14.1 May 22, 2017 Go to the documentation of collection 1.14.1 Download collection 1.14.1 archive
1.14.0 Mar 26, 2017 Go to the documentation of collection 1.14.0 Download collection 1.14.0 archive

All 35 versions...

Analysis

We analyzed this package on Jun 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
99 / 100
Health:
Code health derived from static analysis. [more]
58 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
31 / 100
Overall score:
Weighted score of the above. [more]
73
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:collection/collection.dart.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 39 errors 176 hints.

    Strong-mode analysis of lib/src/canonicalized_map.dart failed with the following error:

    line: 109 col: 24
    Undefined name 'Maps'.

    Strong-mode analysis of lib/src/empty_unmodifiable_set.dart failed with the following error:

    line: 12 col: 31
    Base class introduces an invalid override. The type of 'Iterable.retype' ('<R>() → Iterable<R>') isn't a subtype of 'Set<E>.retype' ('<R>() → Set<R>').

    Similar analysis of the following files failed:

    • lib/src/equality_map.dart (error)
    • lib/src/equality_set.dart (error)
    • lib/src/queue_list.dart (error)
    • lib/src/typed_wrappers.dart (error)
    • lib/src/unmodifiable_wrappers.dart (error)
    • lib/src/wrappers.dart (error)
    • lib/src/algorithms.dart (hint)
    • lib/src/comparators.dart (hint)
    • lib/src/equality.dart (hint)
    • lib/src/functions.dart (hint)
    • lib/src/iterable_zip.dart (hint)
    • lib/src/priority_queue.dart (hint)
    • lib/src/utils.dart (hint)
    • lib/wrappers.dart (hint)
  • Package is getting outdated.

    The package was released 84 weeks ago.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use collection.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.21.0-dev.1.0 <2.0.0
Dev dependencies
test ^0.12.0