Changeset 3637 in josm


Ignore:
Timestamp:
2010-10-24T10:25:26+02:00 (14 years ago)
Author:
jttt
Message:

Fix name clash compilation problem (compilation worked with JDK 6, but it's a bug and new eclipse compiler didn't compile the code)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/MultiMap.java

    r3083 r3637  
    44import java.util.HashMap;
    55import java.util.LinkedHashSet;
     6import java.util.Map;
     7import java.util.Set;
    68
    79/**
    810 * Maps keys to ordered sets of values.
    911 */
    10 public class MultiMap<A, B> extends HashMap<A, LinkedHashSet<B>> {
     12public class MultiMap<A, B>  {
     13
     14    private final Map<A, LinkedHashSet<B>> map = new HashMap<A, LinkedHashSet<B>>();
    1115    /**
    1216     * Map a key to a value. Can be called multiple times with the same key, but different value.
    1317     */
    1418    public void put(A key, B value) {
    15         LinkedHashSet<B> vals = get(key);
     19        LinkedHashSet<B> vals = map.get(key);
    1620        if (vals == null) {
    1721            vals = new LinkedHashSet<B>();
    18             put(key, vals);
     22            map.put(key, vals);
    1923        }
    2024        vals.add(value);
     
    2529     */
    2630    public void putVoid(A key) {
    27         if (containsKey(key))
     31        if (map.containsKey(key))
    2832            return;
    29         put(key, new LinkedHashSet<B>());
     33        map.put(key, new LinkedHashSet<B>());
    3034    }
    3135
     
    3539     */
    3640    public LinkedHashSet<B> getValues(A key) {
    37         if (!containsKey(key))
     41        if (!map.containsKey(key))
    3842            return new LinkedHashSet<B>();
    39         return get(key);
     43        return map.get(key);
     44    }
     45
     46    public Set<A> keySet() {
     47        return map.keySet();
     48    }
     49
     50    public Set<B> get(A key) {
     51        return map.get(key);
    4052    }
    4153}
Note: See TracChangeset for help on using the changeset viewer.