Skip to content

Commit

Permalink
Javadocs for objectPrimitiveMaps.
Browse files Browse the repository at this point in the history
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
  • Loading branch information
jdimeo committed Jun 1, 2020
1 parent 2443136 commit 12d2da1
Showing 1 changed file with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,82 @@ import org.eclipse.collections.api.tuple.primitive.Object<name>Pair;
*/
public interface Object<name>Map\<K> extends <name>Iterable
{
/**
* Retrieves the value associated with the key. If no mapping exists for the key,
* the default value (usually {@code 0}) is returned.
* @param key the key
* @return the value associated with the key, or the default value if no such
* mapping exists
*/
<type> get(Object key);

/**
* Retrieves the value associated with the key, throwing an {@link IllegalStateException}
* if no such mapping exists.
* @param key the key
* @return the value associated with the key
* @throws IllegalStateException if no mapping exists for the key
*/
<type> getOrThrow(Object key);

/**
* Retrieves the value associated with the key, returning the specified default
* value if no such mapping exists.
* @param key the key
* @param ifAbsent the default value to return if no mapping exists for {@code key}
* @return the value associated with the key, or {@code ifAbsent} if no such
* mapping exists.
*/
<type> getIfAbsent(Object key, <type> ifAbsent);

/**
* Returns whether or not the key is present in the map.
* @param key the key
* @return if a mapping exists in this map for the key
*/
boolean containsKey(Object key);

/**
* Returns whether or not this map contains the value.
* @param value the value to test
* @return if this collection contains the value
*/
boolean containsValue(<type> value);

/**
* Iterates through each value in this map.
* @param procedure the procedure to invoke for each value in this map.
*/
void forEachValue(<name>Procedure procedure);

/**
* Iterates through each key in the map, invoking the procedure for each.
* @param procedure the procedure to invoke for each key
*/
void forEachKey(Procedure\<? super K> procedure);

/**
* Iterates through each key/value pair in the map, invoking the procedure for each.
* @param procedure the procedure to invoke for each key/value pair
*/
void forEachKeyValue(Object<name>Procedure\<? super K> procedure);
<if(!primitive.booleanPrimitive)><(flipUniqueValues.(name))(name)><endif>

/**
* Return a copy of this map containing only the key/value pairs that match the predicate.
* @param predicate the predicate to determine which key/value pairs in this map should be
* included in the returned map
* @return a copy of this map with the matching key/value pairs
*/
Object<name>Map\<K> select(Object<name>Predicate\<? super K> predicate);

/**
* Return a copy of this map containing only the key/value pairs that do not match the
* predicate.
* @param predicate the predicate to determine which key/value pairs in this map should be
* excluded from the returned map
* @return a copy of this map without the matching key/value pairs
*/
Object<name>Map\<K> reject(Object<name>Predicate\<? super K> predicate);

/**
Expand All @@ -69,18 +126,41 @@ public interface Object<name>Map\<K> extends <name>Iterable
*/
String toString();

/**
* Returns a copy of this map that is immutable (if this map is mutable) or
* itself if it is already immutable.
* @return an immutable map that is equivalent to this one
*/
ImmutableObject<name>Map\<K> toImmutable();

/**
* Returns a set containing all the keys in this map. The set is backed by the
* map, so any modifications to the returned set will affect this map.
* @return a mutable set containing the keys in this map
*/
Set\<K> keySet();

/**
* Returns the values in this map as a separate collection. The returned collection is backed by the map, so any
* changes made to the returned collection will affect the state of this map.
* @return the values as a collection backed by this map
*/
Mutable<name>Collection values();

/**
* Returns a view of the keys in this map. This iterable is backed by the map, so
* any modifications to the underlying map will be reflected in the keys returned
* by the iterable.
* @return a view of the keys in this map
* @since 5.0
*/
LazyIterable\<K> keysView();

/**
* Returns a view of the key/value pairs in this map. This iterable is backed by
* the map, so any modifications to the underlying map will be reflected in the
* pairs returned by the iterable.
* @return a view of the keys in this map
* @since 5.0
*/
RichIterable\<Object<name>Pair\<K>\> keyValuesView();
Expand Down

0 comments on commit 12d2da1

Please sign in to comment.