eclipse-collections icon indicating copy to clipboard operation
eclipse-collections copied to clipboard

Add toStack to Ordered primitive Iterable

Open donraab opened this issue 5 years ago • 5 comments

There is a method toStack on OrderedIterable, but no equivalent toStack method on Ordered<Primitive>Iterable.

donraab avatar Dec 23 '20 23:12 donraab

@donraab - I'd like to work on this. Can you please assign it to me?

Hi @DineshPurushothamacharya, thanks for volunteering! I've assigned it to you.

donraab avatar Feb 12 '21 22:02 donraab

Hello @donraab,

So far I understand that I need to update orderedPrimitiveIterable.stg file like below. correct me if am wrong.

default Mutable<name>Stack toStack()
{
   return 
}

I have a question on creating the MutableStack instance from the iterable. Could you help me pointing to the right factory method to create this instance?

Hi @DineshPurushothamacharya, the static factories are not available in the interfaces for primitive collections, so you will not be able to implement this in a default method. You can throw UnsupportedOperationException in the default method, and then implement it in the specific implementations.

donraab avatar Feb 16 '21 20:02 donraab

Hello @donraab ,

I have created the below PR [1] for this issue. Could you please review it ?

[1] : https://github.com/eclipse/eclipse-collections/pull/1068