source: josm/trunk/src/org/openstreetmap/josm/tools/MultiMap.java@ 2803

Last change on this file since 2803 was 2702, checked in by bastiK, 14 years ago

fixed #4100 - unable to simply load already referenced images
Added 'jpg' to the list of available formats for 'File' > 'Open...'

File size: 522 bytes
Line 
1// License: GPL. See LICENSE file for details.
2package org.openstreetmap.josm.tools;
3
4import java.util.ArrayList;
5import java.util.List;
6import java.util.HashMap;
7
8/**
9 * Maps keys to a list of values. Partial implementation. Extend if you need more!
10 */
11public class MultiMap<A, B> extends HashMap<A, List<B>> {
12 public void add(A key, B value) {
13 List<B> vals = get(key);
14 if (vals == null) {
15 vals = new ArrayList<B>();
16 put(key, vals);
17 }
18 vals.add(value);
19 }
20}
Note: See TracBrowser for help on using the repository browser.