Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread sebb
On Thu, 13 Jun 2019 at 14:15, Gary Gregory wrote: > > I like addFirst() and addLast() because these are the same kind of names as > the existing java.util.List.add(int, E) which should be familiar to people. > > I feel that interpreting addFirst() as "add after first" breaks the > principle of lea

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread Gary Gregory
I like addFirst() and addLast() because these are the same kind of names as the existing java.util.List.add(int, E) which should be familiar to people. I feel that interpreting addFirst() as "add after first" breaks the principle of least surprise. Gary On Thu, Jun 13, 2019 at 9:03 AM Mark Dacek

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread Mark Dacek
addFirst is commonly used with LinkedLists. I wouldn't think it to be unintuitive. On Thu, Jun 13, 2019 at 8:56 AM sebb wrote: > On Thu, 13 Jun 2019 at 13:43, Gary Gregory wrote: > > > > On Thu, Jun 13, 2019 at 8:32 AM sebb wrote: > > > > > On Wed, 12 Jun 2019 at 22:11, Mark Dacek wrote: > >

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread sebb
On Thu, 13 Jun 2019 at 13:43, Gary Gregory wrote: > > On Thu, Jun 13, 2019 at 8:32 AM sebb wrote: > > > On Wed, 12 Jun 2019 at 22:11, Mark Dacek wrote: > > > > > > I’d support adding both. > > > > +1 > > > > How about overloading as follows: > > > > ArrayUtils.add(T[], T, index) > > > > Ah, I se

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread Gary Gregory
On Thu, Jun 13, 2019 at 8:32 AM sebb wrote: > On Wed, 12 Jun 2019 at 22:11, Mark Dacek wrote: > > > > I’d support adding both. > > +1 > > How about overloading as follows: > > ArrayUtils.add(T[], T, index) > Ah, I see we already deprecated an "add at index" method in favor of "insert at index":

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread Gary Gregory
On Thu, Jun 13, 2019 at 8:32 AM sebb wrote: > On Wed, 12 Jun 2019 at 22:11, Mark Dacek wrote: > > > > I’d support adding both. > > +1 > > How about overloading as follows: > > ArrayUtils.add(T[], T, index) > > It seems inconsistent to have add() and addFirst(); that suggests > there should be an

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-13 Thread sebb
On Wed, 12 Jun 2019 at 22:11, Mark Dacek wrote: > > I’d support adding both. +1 How about overloading as follows: ArrayUtils.add(T[], T, index) It seems inconsistent to have add() and addFirst(); that suggests there should be an addLast() > On Wed, Jun 12, 2019 at 5:09 PM James Carman > wrot

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-12 Thread Mark Dacek
I’d support adding both. On Wed, Jun 12, 2019 at 5:09 PM James Carman wrote: > I like it. Seems like a logical thing to do. Another idea would be adding > at an arbitrary index. > > On Wed, Jun 12, 2019 at 5:04 PM Gary Gregory > wrote: > > > Hi All: > > > > We have org.apache.commons.lang3.Ar

Re: [lang] ArrayUtils.addFirst(T[], T)?

2019-06-12 Thread James Carman
I like it. Seems like a logical thing to do. Another idea would be adding at an arbitrary index. On Wed, Jun 12, 2019 at 5:04 PM Gary Gregory wrote: > Hi All: > > We have org.apache.commons.lang3.ArrayUtils.add(T[], T). > > WDYT about adding a method that adds the element at the beginning of t

[lang] ArrayUtils.addFirst(T[], T)?

2019-06-12 Thread Gary Gregory
Hi All: We have org.apache.commons.lang3.ArrayUtils.add(T[], T). WDYT about adding a method that adds the element at the beginning of the new array instead of the end? Gary