Java · Keys

Keys

import cloud.unum.usearch.*; 3.0.0-rc.1 · 4c3e5023

A key is sixteen opaque bytes rendered as a lowercase dashed UUID, and integer identities park in the low eight bytes. Key.of(42) therefore prints as 00000000-0000-0000-0000-00000000002a, byte for byte the same rendering every other USearch SDK produces. Keys need not be unique: several entries may share one, and count reports how many.

Those sixteen bytes are a java.util.UUID’s two big-endian longs, so toUUID and fromUUID convert without reordering anything. Key.parse is the wider reader of the two: it takes thirty-two hexadecimal digits with dashes anywhere or nowhere, in either case, which is the spelling every USearch SDK writes and reads. Key also orders its bytes unsigned, where UUID.compareTo reads the same two longs as signed.

Key key = Key.of(42);
Key parsed = Key.parse("00000000-0000-0000-0000-00000000002a");
Key adopted = Key.fromUUID(UUID.randomUUID());
long identity = key.toLong();

API

Types

KeyA 128-bit entry identity, most significant byte first, rendered as a lowercase dashed UUID.
Types.java:77 ↗
class Key

The sixteen bytes are a UUID's two big-endian longs, so toUUID() and fromUUID(UUID) convert without reordering anything.

Keys need not be unique: several entries may share one, and DenseVerbs#count(Key) reports how many. Integer identities park in the low eight bytes, so Key.of(42) prints as 00000000-0000-0000-0000-00000000002a.

Fields

BYTESfinal intThe width of a key in bytes, and the row pitch of every key matrix crossing the boundary.
NILfinal KeyThe all-zero key.