Ignore:
Timestamp:
2010-11-25T18:06:50+01:00 (14 years ago)
Author:
bastiK
Message:

Replace Bag by MultiMap.
Both collections are quite similar, but there is a technical difference: Bag is backed by an ArrayList and MultiMap by a LinkedHashSet. So with a Bag you could map a key multiple times to a certain value. I haven't found any usage where this behaviour is required or intended.
Also there could be a certain performance drawback with LinkedHashSet compared to ArrayList. However in the typical validator use case the value collection represents duplicate or crossing ways, so the number of elements is usually 1 or 2 and mostly smaller than the initial capacity (LHS=16, AL=10). (But I could have overlooked some use cases.)

File:
1 edited

Legend:

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

    r3504 r3674  
    1111        return false;
    1212    }
     13
     14    /**
     15     * Get minimum of 3 values
     16     */
     17    public static int min(int a, int b, int c) {
     18        if (b < c) {
     19            if (a < b)
     20                return a;
     21            return b;
     22        } else {
     23            if (a < c) {
     24                return a;
     25            }
     26            return c;
     27        }
     28    }
    1329}
Note: See TracChangeset for help on using the changeset viewer.