JUtil

net.cscott.jutil
Interface InvertibleMap<K,V>

All Superinterfaces:
Map<K,V>
All Known Subinterfaces:
InvertibleMultiMap<K,V>
All Known Implementing Classes:
GenericInvertibleMap, GenericInvertibleMultiMap

public interface InvertibleMap<K,V>
extends Map<K,V>

An InvertibleMap is an extension of the Map interface to allow users to do reverse lookups on the mappings maintained. Since Maps 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 2006-10-30 19:58:06 cananian Exp $
Author:
Felix S. Klock II

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 MultiMap<V,K> invert()
          Returns a inverted view of this.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

invert

MultiMap<V,K> 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.


JUtil

Copyright (c) 2006 C. Scott Ananian