Ignore:
Timestamp:
2011-12-21T15:44:53+01:00 (12 years ago)
Author:
bastiK
Message:

session support (second part: "save as", see #4029)

still osm-data layer is the only implemented layer type

File:
1 edited

Legend:

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

    r4668 r4685  
    3131
    3232    /**
    33      * Map a key to a value. Can be called multiple times with the same key, but different value.
     33     * Map a key to a value.
     34     *
     35     * Can be called multiple times with the same key, but different value.
    3436     */
    3537    public void put(A key, B value) {
     
    4446    /**
    4547     * Put a key that maps to nothing. (Only if it is not already in the map)
     48     *
    4649     * Afterwards containsKey(key) will return true and get(key) will return
    4750     * an empty Set instead of null.
     
    5457
    5558    /**
    56      * Get the keySet
     59     * Map the key to all the given values.
     60     *
     61     * Adds to the mappings that are already there.
     62     */
     63    public void putAll(A key, Collection<B> values) {
     64        LinkedHashSet<B> vals = map.get(key);
     65        if (vals == null) {
     66            vals = new LinkedHashSet<B>(values);
     67            map.put(key, vals);
     68        }
     69        vals.addAll(values);
     70    }
     71
     72    /**
     73     * Get the keySet.
    5774     */
    5875    public Set<A> keySet() {
     
    6178
    6279    /**
    63      * Return the Set associated with the given key. Result is null if
    64      * nothing has been mapped to this key. Modifications of the returned list
    65      * changes the underling map, but you should better not do that.
     80     * Returns the Set associated with the given key. Result is null if
     81     * nothing has been mapped to this key.
     82     *
     83     * Modifications of the returned list changes the underling map,
     84     * but you should better not do that.
    6685     */
    6786    public Set<B> get(A key) {
     
    87106
    88107    /**
    89      * Returns true if the multimap contains a value for a key
     108     * Returns true if the multimap contains a value for a key.
     109     *
    90110     * @param key The key
    91111     * @param value The value
     
    106126
    107127    /**
    108      * number of keys
     128     * Returns the number of keys.
    109129     */
    110130    public int size() {
     
    113133
    114134    /**
    115      * returns a collection of all value sets
     135     * Returns a collection of all value sets.
    116136     */
    117137    public Collection<LinkedHashSet<B>> values() {
     
    120140
    121141    /**
    122      * Removes a cerain key=value mapping
     142     * Removes a cerain key=value mapping.
    123143     *
    124144     * @return true, if something was removed
     
    133153
    134154    /**
    135      * Removes all mappings for a certain key
     155     * Removes all mappings for a certain key.
    136156     */
    137157    public LinkedHashSet<B> remove(A key) {
Note: See TracChangeset for help on using the changeset viewer.