afs commented on code in PR #2097:
URL: https://github.com/apache/jena/pull/2097#discussion_r1397120028
##########
jena-core/src/main/java/org/apache/jena/shared/impl/PrefixMappingImpl.java:
##########
@@ -49,8 +50,8 @@ public PrefixMappingImpl()
{
// ConcurrentHashMaps protects against breaking each datastructure
// but does not protect against inconsistency.
- prefixToURI = new ConcurrentHashMap<>();
- URItoPrefix = new ConcurrentHashMap<>();
+ prefixToURI = new ConcurrentSkipListMap<>();
+ URItoPrefix = new ConcurrentSkipListMap<>();
}
Review Comment:
The order of entries in a `PrefixMapping` is not guaranteed. This part of
the contract of for `PrefixMapping` that it is a map.
There are other implementations of `PrefixMapping` - they also do not
preserve order.
Where is this causing you a problem?
Code that uses a map or set of any kind needs be aware that order is not
preserved.
`ConcurrentSkipListMap` is more expensive for some operations. We have had
situations around writing RDF when there are many prefix mappings, where the
performance of prefixes matters.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]