Unsafe: efficiently comparing two byte arrays

Andrew Haley aph at redhat.com
Thu Feb 27 14:52:38 UTC 2014


Hi,

On 02/26/2014 03:42 PM, Paul Sandoz wrote:

> A common reason why Unsafe is used is to more efficiently compare two unsigned byte arrays, viewing those byte arrays as long arrays.

Why not simply provide ByteBuffer.forArray(byte[]) ?  Then we'd have all the
ByteBuffer intrinsics for put() and get() operations.

Andrew.



More information about the core-libs-dev mailing list