Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37957 > unrolled thread
| Started by | iamsqq@gmail.com |
|---|---|
| First post | 2018-01-18 06:09 -0800 |
| Last post | 2018-01-19 20:43 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Why doesn't ArrayDeque implement the List interface? iamsqq@gmail.com - 2018-01-18 06:09 -0800
Re: Why doesn't ArrayDeque implement the List interface? Marcel Mueller <news.5.maazl@spamgourmet.org> - 2018-01-19 20:43 +0100
| From | iamsqq@gmail.com |
|---|---|
| Date | 2018-01-18 06:09 -0800 |
| Subject | Re: Why doesn't ArrayDeque implement the List interface? |
| Message-ID | <2b73f760-3154-4de3-a2ee-e16380b53637@googlegroups.com> |
On Wednesday, March 4, 2009 at 8:55:14 AM UTC+8, Joe Gottman wrote: > I have an application where I need to access the elements of a > container by index and add and remove elements at either end. I thought > that ArrayDeque was the obvious solution, but I was surprised to find > that it doesn't implement the List interface. Why is this? My use case > isn't unusual; it's the same as the C++ deque template. It's especially > galling in that it would be possible to implement a get() member > function with constant time complexity in ArrayDeque, but the LinkedList > class, which does implement the List() interface, requires linear time > to perform get(). It seems backward to me that Java mandates the less > efficient data structure for my use case. > > Joe Gottman I just noticed that ArrayList and LinkedList are added in Java 1.2, while ArrayDeque is added in Java 6. Maybe the team think it is better for the new implementation ArrayDeque to be only for Deque, and leaving ArrayList for List. Hogan Shi
[toc] | [next] | [standalone]
| From | Marcel Mueller <news.5.maazl@spamgourmet.org> |
|---|---|
| Date | 2018-01-19 20:43 +0100 |
| Message-ID | <p3tho8$2hj$2@gwaiyur.mb-net.net> |
| In reply to | #37957 |
On 18.01.18 15.09, iamsqq@gmail.com wrote: > On Wednesday, March 4, 2009 at 8:55:14 AM UTC+8, Joe Gottman wrote: [...] > I just noticed that ArrayList and LinkedList are added in Java 1.2, [...] Seems that it took a bit longer to write the answer this time. :-) Marcel
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web