/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ package ds.interfaces; /** Simple interface for maps */ import java.util.Iterator; import ds.util.Invariant; import ds.util.Function2; import ds.util.K; // example class for keys import ds.util.V; // example class for values import ds.util.KV; // key value pair public interface Map extends Iterable, Invariant { boolean isEmpty(); boolean member(K k); V lookup(K k); int size(); KV findMin(); KV findMax(); Map insert(K k, V v); Map remove(K k); Map union(Map m2); Map difference(Map m2); Map unionWith(Function2 op, Map m2); Map differenceWith(Function2 op, Map m2); Map copy(); // inherited // public Iterator iterator(); // public inv(); }