kwin commented on code in PR #106:
URL: https://github.com/apache/maven-doxia/pull/106#discussion_r916056669
##########
doxia-core/src/main/java/org/apache/maven/doxia/index/IndexingSink.java:
##########
@@ -323,6 +331,26 @@ public void text( String text )
}
}
+ /**
+ * Converts the given id into a unique one by potentially suffix it with a
counter value.
+ * @param id
+ * @return the unique id
+ */
+ String getUniqueId( String id )
+ {
+ final String uniqueId;
+ if ( usedIds.containsKey( id ) )
+ {
+ uniqueId = id + "_" + usedIds.get( id ).incrementAndGet();
+ }
+ else
+ {
+ usedIds.put( id, new AtomicInteger() );
Review Comment:
I need to check not only to create if it is not there, but also to suffix if
it is there. The latter can not be replaced by `computeIfAbsent()` therefore I
would leave it like this.
--
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]