-
Notifications
You must be signed in to change notification settings - Fork 96
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
Preserve collection order of dimensions, dimension fields and metrics #25
Conversation
4fc4161
to
9bf4346
Compare
👍 |
Changelog needed, since this changes some method signatures. |
9bf4346
to
535e4fc
Compare
@@ -46,7 +47,7 @@ public static Response makeJobMetadataResponse(String jobMetadata) { | |||
* @return A PreResponse containing the error information that should be sent to the user | |||
*/ | |||
public static PreResponse buildErrorPreResponse(Throwable throwable) { | |||
ResponseContext responseContext = new ResponseContext(Collections.emptyMap()); | |||
ResponseContext responseContext = new ResponseContext(new LinkedHashMap<>()); |
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.
Rather than make a new object each time, it would be good if we could only create 1 object and just re-use that over and over (like what Collections.emptyMap()
did).
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.
That sounds dangerous to me, unless we take steps to make sure the empty map is immutable. The reason Collections.emptyMap
is safe is because it's immutable, so you don't have to worry about someone accidentally modifying the map and spreading the changes all over the system.
Frankly, the overhead of building an empty collection is so tiny that I doubt creating our own custom empty, immutable LinkedHashMap
is worth the effort.
535e4fc
to
873553f
Compare
👍 |
No description provided.