groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Rodent (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8565) Method from java.util.Deque to be added to Groovy List?
Date Thu, 03 May 2018 07:29:00 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8565?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mike Rodent updated GROOVY-8565:
--------------------------------
    Description: 
I was surprised to find that List in the GDK hasn't added `addFirst` method. AKA `shift`. 
Also `removeFirst` AKA `unshift`.

I'm intrigued to see that in Groovy 3.0.0 (not in beta at time of writing) `push` and `pop`
*appear* to be changing from adding/removing at the end, as currently, to adding/removing
at the *beginning*, "to align with java.util.Stack".  So can we conclude that the need for
more stack/queue/deque methods has been recognised?

Of course there are multiple ways of doing this... it's just that that means that it's slightly
less convenient to use a standard Groovy List as an interesting form of queue or deque.

`addLast` seems less necessary because you have `Iterable.plus()`... but `addFirst` would
be nice, it seems to me.  Or is there a Groovy idiom for this already?

java.util.Deque has some other interesting methods which one might want to think about too:
offerXXX, peekXXX, getXXX.

  was:
I was surprised to find that List in the GDK hasn't added `addFirst` method. AKA `shift`. 
Also `removeFirst` AKA `unshift`.

I'm intrigued to see that in Groovy 3.0.0 (not in beta at time of writing) `push` and `pop`
*appear* to be changing from adding/removing at the end, as currently, to adding/removing
at the end, "to align with java.util.Stack".  So can we conclude that the need for more stack/queue/deque
methods has been recognised?

Of course there are multiple ways of doing this... it's just that that means that it's slightly
less convenient to use a standard Groovy List as an interesting form of queue or deque.

`addLast` seems less necessary because you have `Iterable.plus()`... but `addFirst` would
be nice, it seems to me.  Or is there a Groovy idiom for this already?

java.util.Deque has some other interesting methods which one might want to think about too:
offerXXX, peekXXX, getXXX.


> Method from java.util.Deque to be added to Groovy List?
> -------------------------------------------------------
>
>                 Key: GROOVY-8565
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8565
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Mike Rodent
>            Priority: Minor
>
> I was surprised to find that List in the GDK hasn't added `addFirst` method. AKA `shift`. 
Also `removeFirst` AKA `unshift`.
> I'm intrigued to see that in Groovy 3.0.0 (not in beta at time of writing) `push` and
`pop` *appear* to be changing from adding/removing at the end, as currently, to adding/removing
at the *beginning*, "to align with java.util.Stack".  So can we conclude that the need for
more stack/queue/deque methods has been recognised?
> Of course there are multiple ways of doing this... it's just that that means that it's
slightly less convenient to use a standard Groovy List as an interesting form of queue or
deque.
> `addLast` seems less necessary because you have `Iterable.plus()`... but `addFirst` would
be nice, it seems to me.  Or is there a Groovy idiom for this already?
> java.util.Deque has some other interesting methods which one might want to think about
too: offerXXX, peekXXX, getXXX.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message