harpoon.Util.Collections
Interface InvertibleMap
- All Superinterfaces:
- Map
- All Known Implementing Classes:
- GenericInvertibleMap
- public interface InvertibleMap
- extends Map
An InvertibleMap
is an extension of the
Map
interface to allow users to do reverse lookups on
the mappings maintained.
Since Map
s are allowed to map multiple keys to a
single value, the inversion of a Map
is not
necessarily a Map
itself; thus we return a
MultiMap
for the inverted view. The returned
MultiMap
is not guaranteed to be modfiable, even if
this
is (ie, changes to the data structure may still
have to be made through this
rather than directly to
the returned MultiMap
).
- Version:
- $Id: InvertibleMap.java,v 1.2 2002/02/25 21:09:04 cananian Exp $
- Author:
- Felix S. Klock II <pnkfelix@mit.edu>
Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
invert
public MultiMap invert()
- Returns a inverted view of
this
.
Thus, if this
is a Map
with domain A
and range B, the returned MultiMap
,
imap
, will be a MultiMap
with domain
B and range A, such that each b in B will map in
imap
to Collection of A, c, if and only if
each a in c maps to b in
this
.