Skip to content

Replacement of PayloadUUID.getPayLoad() method #881

Answered by belaban
prateekjainaa asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this would work, but it is very inefficient. I suggest change the key to a byte array:

final byte[] key=Util.stringToBytes(PAYLOAD);
if(payloaduuidAddress.keyExists(key)) {
   // .. do something here
}

Note that the get() method iterates through all keys. If you have many keys, this linear cost will decrease performance. You could create your own subclass of FlagsUUID, e.g. by copying ExtendedUUID and replacing keys and values with a ConcurrentHashmap.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@prateekjainaa
Comment options

Answer selected by prateekjainaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants