pharo-containers / Containers-OrderedSet

A Set where an order of elements matters or an OrderedCollection with no duplicates. Supports the complete API of Set and OrderedCollection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Containers-OrderedSet

Build Status Build status Coverage Status License Pharo version Pharo version Pharo version

A Set where an order of elements matters or an OrderedCollection with no duplicates. Supports the complete API of Set and OrderedCollection.

Installation

To install CTOrderedSet, go to the Playground (Ctrl+OW) in your Pharo image and execute the following Metacello script (select it and press Do-it button or Ctrl+D):

Metacello new
  baseline: 'ContainersOrderedSet';
  repository: 'github://pharo-containers/Containers-OrderedSet/src';
  load.

How to depend on it?

If you want to add a dependency on OrderedSet to your project, include the following lines into your baseline:

spec
  baseline: 'ContainersOrderedSet'
  with: [ spec repository: 'github://pharo-containers/Containers-OrderedSet/src' ].

To read more about baselines and Metacello, check out the Baselines article on Pharo Wiki.

How to use it?

CTOrderedSet has the same API as OrderedCollection, extended with the methods of Set. So instance creation looks the same:

firstBasket := CTOrderedSet withAll: #(apple apple orange banana orange banana).
secondBasket := CTOrderedSet withAll: #(banana apple banana banana). 

Or you can use the asOrderedSet method:

firstBasket := #(apple apple orange banana orange banana) asOrderedSet.
secondBasket := #(banana apple banana banana) asOrderedSet. 

About

A Set where an order of elements matters or an OrderedCollection with no duplicates. Supports the complete API of Set and OrderedCollection

License:MIT License


Languages

Language:Smalltalk 99.1%Language:HTML 0.9%