-
Notifications
You must be signed in to change notification settings - Fork 612
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
[cmd] Define order of parallel groups #6602
Conversation
This feels risky; too much chance of the state falling out of sync. Is there no map that preserves insertion order? If C++ uses pairs then maybe Java should too (use Map.Entry). |
Use LinkedHashMap, which preserves insertion order. |
I would use I'll also point out that in |
|
After thinking about this some more, I've decided that it makes sense for this PR to make the minimal changes to define the order of iteration (so yes I'll be using |
wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/ParallelCommandGroup.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done on the detailed comments!
FYI there will be conflicts with #6032 depending on merge order |
Using lists in Java parallel groups guarantees iteration order and also matches C++. (Although this uses two separate lists to avoid having to allocate
Pair
objects.)Note that after this PR gets merged, #6599 should be updated to change the
DeadlineFor
,AlongWith
, andRaceWith
tests to usestd::move(command).Decorate
instead ofstd::move(command).ToPtr().Decorate
. (Or after the other PR gets merged, this PR should be updated to use the new decorators.)