Package org.eclipse.jetty.util
Interface Index<V>
- Type Parameters:
V
- the entry type
- All Known Subinterfaces:
Index.Mutable<V>
public interface Index<V>
An immutable String lookup data structure.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Builder ofIndex
instances.static interface
A mutable String lookup data structure. -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> Index.Mutable<V>
buildMutableVisibleAsciiAlphabet
(boolean caseSensitive, int maxCapacity) A special purpose static builder for fast creation of specific Index typedefault boolean
Check if there is an exact match from a String keystatic <V> Index<V>
empty
(boolean caseSensitive) Get an exact match from a String keyGet an exact match from a String keyget
(ByteBuffer b) Get an exact match from a segment of a ByteBuffer as keyget
(ByteBuffer b, int offset, int len) Get an exact match from a segment of a ByteBuffer as keydefault V
getBest
(byte[] b) Get the best match from key in a byte array.getBest
(byte[] b, int offset, int len) Get the best match from key in a byte array.Get the best match from key in a String, which may be a prefix match or an exact match.Get the best match from key in a String.default V
Get the best match from key in a byte buffer.getBest
(ByteBuffer b, int offset, int len) Get the best match from key in a byte buffer.boolean
isEmpty()
Check if the index contains any entry.keySet()
Get aSet
of the keys contained in this index.int
size()
Get the number of entries in the index.
-
Method Details
-
get
Get an exact match from a String key- Parameters:
s
- The key, possibly null- Returns:
- the value for the string key
-
get
Get an exact match from a segment of a ByteBuffer as key- Parameters:
b
- The buffer- Returns:
- The value or null if not found
-
get
Get an exact match from a String key- Parameters:
s
- The key, possibly nulloffset
- The offset within the string of the keylen
- the length of the key- Returns:
- the value for the string / offset / length
-
get
Get an exact match from a segment of a ByteBuffer as key- Parameters:
b
- The bufferoffset
- The offset within the buffer of the keylen
- the length of the key- Returns:
- The value or null if not found
-
contains
Check if there is an exact match from a String key- Parameters:
s
- The key, possibly null- Returns:
- true if there is a match, false otherwise
-
getBest
Get the best match from key in a String.- Parameters:
s
- The string, possibly nulloffset
- The offset within the string of the keylen
- the length of the key- Returns:
- The value or null if not found
-
getBest
Get the best match from key in a String, which may be a prefix match or an exact match.- Parameters:
s
- The string, possibly null- Returns:
- The value or null if not found
-
getBest
Get the best match from key in a byte buffer. The key is assumed to by ISO_8859_1 characters.- Parameters:
b
- The bufferoffset
- The offset within the buffer of the keylen
- the length of the key- Returns:
- The value or null if not found
-
getBest
Get the best match from key in a byte buffer. The key is assumed to by ISO_8859_1 characters.- Parameters:
b
- The buffer- Returns:
- The value or null if not found
-
getBest
Get the best match from key in a byte array. The key is assumed to by ISO_8859_1 characters.- Parameters:
b
- The bufferoffset
- The offset within the array of the keylen
- the length of the key- Returns:
- The value or null if not found
-
getBest
Get the best match from key in a byte array. The key is assumed to by ISO_8859_1 characters.- Parameters:
b
- The buffer- Returns:
- The value or null if not found
-
isEmpty
boolean isEmpty()Check if the index contains any entry.- Returns:
- true if the index does not contain any entry.
-
size
int size()Get the number of entries in the index.- Returns:
- the index' entries count.
-
keySet
Get aSet
of the keys contained in this index.- Returns:
- a
Set
of the keys contained in this index.
-
buildMutableVisibleAsciiAlphabet
static <V> Index.Mutable<V> buildMutableVisibleAsciiAlphabet(boolean caseSensitive, int maxCapacity) A special purpose static builder for fast creation of specific Index type- Type Parameters:
V
- The type of the index- Parameters:
maxCapacity
- The max capacity of the index- Returns:
- A case sensitive mutable Index tacking visible ASCII alphabet to a max capacity.
-
empty
-