A bimap (or "bidirectional map") is a map that preserves the uniqueness of its values as well as that of its keys. This constraint enables bimaps to support an "inverse view", which is another bimap containing the same entries as this bimap but with reversed keys and values. See the Guava User G
| 38 | |
| 39 | |
| 40 | @GwtCompatible |
| 41 | public interface BiMap<K, V> extends Map<K, V> { |
| 42 | // Modification Operations |
| 43 | |
| 44 | /** |
| 45 | * {@inheritDoc} |
| 46 | * |
| 47 | * @throws IllegalArgumentException if the given value is already bound to a |
| 48 | * different key in this bimap. The bimap will remain unmodified in this |
| 49 | * event. To avoid this exception, call {@link #forcePut} instead. |
| 50 | */ |
| 51 | |
| 52 | @CanIgnoreReturnValue |
| 53 | @Override |
| 54 | @Nullable |
| 55 | V put(@Nullable K key, @Nullable V value); |
| 56 | |
| 57 | /** |
| 58 | * An alternate form of {@code put} that silently removes any existing entry |
| 59 | * with the value {@code value} before proceeding with the {@link #put} |
| 60 | * operation. If the bimap previously contained the provided key-value |
| 61 | * mapping, this method has no effect. |
| 62 | * |
| 63 | * <p>Note that a successful call to this method could cause the size of the |
| 64 | * bimap to increase by one, stay the same, or even decrease by one. |
| 65 | * |
| 66 | * <p><b>Warning:</b> If an existing entry with this value is removed, the key |
| 67 | * for that entry is discarded and not returned. |
| 68 | * |
| 69 | * @param key the key with which the specified value is to be associated |
| 70 | * @param value the value to be associated with the specified key |
| 71 | * @return the value which was previously associated with the key, which may |
| 72 | * be {@code null}, or {@code null} if there was no previous entry |
| 73 | */ |
| 74 | |
| 75 | |
| 76 | @CanIgnoreReturnValue |
| 77 | @Nullable |
| 78 | V forcePut(@Nullable K key, @Nullable V value); |
| 79 | |
| 80 | // Bulk Operations |
| 81 | |
| 82 | /** |
| 83 | * {@inheritDoc} |
| 84 | * |
| 85 | * <p><b>Warning:</b> the results of calling this method may vary depending on |
| 86 | * the iteration order of {@code map}. |
| 87 | * |
| 88 | * @throws IllegalArgumentException if an attempt to {@code put} any |
| 89 | * entry fails. Note that some map entries may have been added to the |
| 90 | * bimap before the exception was thrown. |
| 91 | */ |
| 92 | |
| 93 | |
| 94 | @Override |
| 95 | void putAll(Map<? extends K, ? extends V> map); |
| 96 | |
| 97 | // Views |
nothing calls this directly
no outgoing calls
no test coverage detected