Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Why are you casting a new array like this? Why not just create that type of array? deque = (EltType[]) (new Object[capacity]) Commented Feb 7, 2011 at 22:39
  • Any particular reason you are implementing this yourself? Homework, self improvement, otherwise? If not, you may want to consider the java.util.ArrayDeque instead. Commented Feb 7, 2011 at 23:33
  • @Joe Phillips - this will not work in Java, try it. It returns an error, it's an unfortunate trait of generic types! Commented Feb 8, 2011 at 17:10