Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TransformedDeque, BlockingDeque, CircularDeque, PredicatedDeque and SynchronizedDeque for deque interface #111

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dota17
Copy link
Contributor

@dota17 dota17 commented Nov 7, 2019

I found someone raised that adding support for deque interface in Collections.(https://issues.apache.org/jira/browse/COLLECTIONS-563)
(https://issues.apache.org/jira/browse/COLLECTIONS-564)
This makes sense so I wrote some code to make a try. I want to know if my implementation is appropriate, if my PR is merged or given comments and suggestions, I would be happy to finish the rest of the work.

@dota17 dota17 changed the title Add TransformedDeque for deque interface Add TransformedDeque, BlockingDeque, CircularDeque, PredicatedDeque and SynchronizedDeque for deque interface Dec 20, 2019
* @param <E> the type of elements in this collection
* @since 4.5
*/
public class CircularDeque<E> extends AbstractCollection<E>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a lot of copy+pase code. Please just wrap a Java JDK ArrayDeque.

https://docs.oracle.com/javase/7/docs/api/java/util/ArrayDeque.html

* @param <E> the type of elements held in this deque
* @since 4.5
*/
public class BlockingDeque<E> extends AbstractCollection<E> implements Deque<E>, Serializable {
Copy link

@belugabehr belugabehr Dec 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a BlockingDeque interface in the Java JDK, so this class name is kind of confusing and it does not implement the interface.

https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/BlockingDeque.html
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/LinkedBlockingDeque.html

I'm not sure how useful decoration will be. Might be more helpful to have an ArrayBlockingDeque class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants