Returns set of all keys in store. @return unmodifiable Set of keys
()
| 321 | * @return unmodifiable Set of keys |
| 322 | */ |
| 323 | @SuppressWarnings("deprecation") // The String ctor is deprecated, but fast. |
| 324 | public Set<String> keys() { |
| 325 | if (isEmpty()) { |
| 326 | return Collections.emptySet(); |
| 327 | } |
| 328 | Set<String> ks = Sets.newHashSetWithExpectedSize(size); |
| 329 | for (int i = 0; i < size; i++) { |
| 330 | ks.add(new String(name(i), 0 /* hibyte */)); |
| 331 | } |
| 332 | // immutable in case we decide to change the implementation later. |
| 333 | return Collections.unmodifiableSet(ks); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Adds the {@code key, value} pair. If {@code key} already has values, {@code value} is added to |