dlmarion commented on code in PR #65:
URL: https://github.com/apache/accumulo-access/pull/65#discussion_r1499635206
##########
src/main/java/org/apache/accumulo/access/Authorizations.java:
##########
@@ -58,9 +59,12 @@ public int hashCode() {
return authorizations.hashCode();
}
+ /**
+ * @return a String containing the sorted, comma-separated set of
authorizations
+ */
@Override
public String toString() {
- return authorizations.toString();
+ return authorizations.stream().sorted().collect(Collectors.joining(","));
Review Comment:
> The TreeSet code would be more simple I think but also would have the
overhead of creating the new TreeSet
I think that assumes that the streaming example creates no objects.
`Collection.stream` calls `StreamSupport.stream`, which creates a new
`ReferencePipeline.Head`:
https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/stream/StreamSupport.java#L67
Calling `sorted` on the `ReferencePipeline` creates more objects:
https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/stream/ReferencePipeline.java#L462
`Collectors.joining` creates two new objects.
https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/stream/Collectors.java#L367
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]