Package com.google.crypto.tink.internal
Class PrefixMap<P>
- java.lang.Object
-
- com.google.crypto.tink.internal.PrefixMap<P>
-
@Immutable public final class PrefixMap<P> extends java.lang.ObjectProvides a map from prefix to arbitrary element, allowing to iterate over all elements whose prefixes matches a givenbyte[].To create a
PrefixMap, the user adds pairs(Prefix, Value), as in a map. To query, the user provides abyte[]and the map will allow to iterate over all values which were added with a prefix of the givenbyte[].Currently only supports prefixes of length 5 and 0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPrefixMap.Builder<P>Builder for PrefixMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<P>getAllWithMatchingPrefix(byte[] text)Provides an iterable which goves over all values which were added with a prefix of the giventext.
-
-
-
Method Detail
-
getAllWithMatchingPrefix
public java.lang.Iterable<P> getAllWithMatchingPrefix(byte[] text)
Provides an iterable which goves over all values which were added with a prefix of the giventext.The matches with the longest prefixes are returned first. Within a given length, the values are returned in the order they were provided in the builder.
-
-