Open pakoito opened 8 years ago
I need some inspiration how to generate a unique key, I dont want to depend to the gson library
Java has hashCode() for these cases, but it requires the user to read the documentation and override the method properly. In this case I would rename the method to generateKeyFromHashes() to be more explicit about it. The price you pay is some primitive autoboxing.
Another uglier one is taking Comparables instead of Objects.
Object... is not an explicit contract. There is no indication that the operation could take long due to serialization + Base64, and it doesn't recommend caching or anything of the sorts. Serialization may cause unintended crashes for non-serializable objects.
As small tweaks, you should move the nullcheck atop the method to avoid allocating the StringBuilder or copying the reference prematurely.
https://github.com/team-supercharge/rxsnappy/blob/master/rxsnappy/src/main/java/io/supercharge/rxsnappy/RxSnappyUtils.java#L39