This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayDeque interface equivalent method with Queue interface

 
Kim Ming Yap
Ranch Hand
Posts: 53
Android C++ Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that ArrayDeque offers both ends of processing (head and tail) but what i don't understand why the method offerlast() is equivalent to offer() method of Queue interface. Why not offerfirst()? Pleae advice. Thanks
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kim Ming Yap wrote:I know that ArrayDeque offers both ends of processing (head and tail) but what i don't understand why the method offerlast() is equivalent to offer() method of Queue interface. Why not offerfirst()? Pleae advice. Thanks


Design decision. They actually had to pick one... Let's say that the designer chosed offerFirst() instead. And hence, remove is mapped to removeLast(), poll is mapped to pollLast(), etc. etc. etc.

Then I guess you can ask the same question, but instead, why isn't it offerLast()?

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic