Hi,

A little more than a year ago I have made a proposal to extend LibGee
when I rewrote the tests for it, but at that time there was not much
interest in the changes. It may be good to repeat what I had in mind
at that time:

> I would also like to propose an extension to the interfaces in form of 
> additional convenient / often used methods. What I had in mind is this:
>
> Collection interface:
> - void add_all(Collection) - Adds all items from the input collection to this 
> collection. Convenient for joining collections. Java also has this on the 
> interface of Collection.
> - bool contains_all(Collection) - Checks if all items in the input collection 
> are present in this collection. Convenient for checking items for example if 
> "a" AND "b" exist in collection.
> - bool contains_any(Collection) - Checks if any items in the input collection 
> are present in this collection. Convenient for checking items for example if 
> "a" OR "b" exist in collection.
> - bool is_empty() - special state of a collection when it doesn't contain any 
> value. Added because it is clearer as list.size == 0.
>
> List interface
> - G first()
> - G last() - First and last items are often special - it adds better clarity 
> to the algorithm if they don't need to be "addressed" as list.get(0) or worse 
> list.get(list.size -1).
>
> Set interface
>
> Map interface
> - void set_all(Map) - Same as add_all for collections.
> - expose Node<K,V> and make it possible to iterate through Nodes:
> foreach (Node<int,int> item in map.get_nodes()) {
> }
>
> Iterators
>  - It would be convenient to have a reverse iterator for lists which would 
> also allow to iterate backwards.
>  - class with special iterators/iterables that can iterate Forward / 
> Backwards, skip elements, iterate through enumerated list, generators

Some of the things have already been proposed and there are other
things on my mind that could be done.

I still have the code of the changes (including tests) somewhere - I
will seek them out and merge them with the latest libgee version.

Maybe it would be a good thing to add on the libgee wiki a subpage
with proposed changes/additions so that all this things aren't
forgotten.

Regards, Tomaž
_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to