Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-04-26T17:39:23+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/CopyList.java
r6717 r7005 116 116 @Override 117 117 public Object clone() { 118 return new CopyList< E>(array, size);118 return new CopyList<>(array, size); 119 119 } 120 120 -
trunk/src/org/openstreetmap/josm/tools/Diff.java
r6889 r7005 96 96 */ 97 97 public Diff(Object[] a, Object[] b) { 98 Map<Object,Integer> h = new HashMap< Object,Integer>(a.length + b.length);98 Map<Object,Integer> h = new HashMap<>(a.length + b.length); 99 99 filevec = new FileData[] { new FileData(a,h),new FileData(b,h) }; 100 100 } -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r6830 r7005 78 78 public static Pair<OsmPrimitive, Collection<OsmPrimitive>> parsePreconditionFailed(String msg) { 79 79 final String ids = "(\\d+(?:,\\d+)*)"; 80 final Collection<OsmPrimitive> refs = new TreeSet< OsmPrimitive>(); // error message can contain several times the same way80 final Collection<OsmPrimitive> refs = new TreeSet<>(); // error message can contain several times the same way 81 81 Matcher m; 82 82 m = Pattern.compile(".*Node (\\d+) is still used by relations " + ids + ".*").matcher(msg); -
trunk/src/org/openstreetmap/josm/tools/FallbackDateParser.java
r6104 r7005 42 42 public FallbackDateParser() { 43 43 // Build a list of candidate date parsers. 44 dateParsers = new ArrayList< DateFormat>(formats.length);44 dateParsers = new ArrayList<>(formats.length); 45 45 for (String format : formats) { 46 46 dateParsers.add(new SimpleDateFormat(format)); -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r6934 r7005 66 66 boolean[] changedWays = new boolean[n]; 67 67 68 Set<Node> intersectionNodes = new LinkedHashSet< Node>();68 Set<Node> intersectionNodes = new LinkedHashSet<>(); 69 69 70 70 //copy node arrays for local usage. 71 71 for (int pos = 0; pos < n; pos ++) { 72 newNodes[pos] = new ArrayList< Node>(ways.get(pos).getNodes());72 newNodes[pos] = new ArrayList<>(ways.get(pos).getNodes()); 73 73 wayBounds[pos] = getNodesBounds(newNodes[pos]); 74 74 changedWays[pos] = false; … … 828 828 829 829 public static class MultiPolygonMembers { 830 public final Set<Way> outers = new HashSet< Way>();831 public final Set<Way> inners = new HashSet< Way>();830 public final Set<Way> outers = new HashSet<>(); 831 public final Set<Way> inners = new HashSet<>(); 832 832 833 833 public MultiPolygonMembers(Relation multiPolygon) { -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r6984 r7005 129 129 private static Map<String, String> strings = null; 130 130 private static Map<String, String[]> pstrings = null; 131 private static Map<String, PluralMode> languages = new HashMap< String, PluralMode>();131 private static Map<String, PluralMode> languages = new HashMap<>(); 132 132 133 133 /** … … 324 324 */ 325 325 public static final Locale[] getAvailableTranslations() { 326 Collection<Locale> v = new ArrayList< Locale>(languages.size());326 Collection<Locale> v = new ArrayList<>(languages.size()); 327 327 if(getTranslationFile("en") != null) 328 328 { … … 490 490 p = pstrings; 491 491 } else { 492 s = new HashMap< String, String>();493 p = new HashMap< String, String[]>();492 s = new HashMap<>(); 493 p = new HashMap<>(); 494 494 } 495 495 /* file format: -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r6995 r7005 111 111 * The icon cache 112 112 */ 113 private static final Map<String, ImageResource> cache = new HashMap< String, ImageResource>();113 private static final Map<String, ImageResource> cache = new HashMap<>(); 114 114 115 115 /** 116 116 * Caches the image data for rotated versions of the same image. 117 117 */ 118 private static final Map<Image, Map<Long, ImageResource>> ROTATE_CACHE = new HashMap< Image, Map<Long, ImageResource>>();118 private static final Map<Image, Map<Long, ImageResource>> ROTATE_CACHE = new HashMap<>(); 119 119 120 120 private static final ExecutorService IMAGE_FETCHER = Executors.newSingleThreadExecutor(); … … 677 677 if (path != null && path.startsWith("resource://")) { 678 678 String p = path.substring("resource://".length()); 679 Collection<ClassLoader> classLoaders = new ArrayList< ClassLoader>(PluginHandler.getResourceClassLoaders());679 Collection<ClassLoader> classLoaders = new ArrayList<>(PluginHandler.getResourceClassLoaders()); 680 680 if (additionalClassLoaders != null) { 681 681 classLoaders.addAll(additionalClassLoaders); … … 896 896 Map<Long, ImageResource> cacheByAngle = ROTATE_CACHE.get(img); 897 897 if (cacheByAngle == null) { 898 ROTATE_CACHE.put(img, cacheByAngle = new HashMap< Long, ImageResource>());898 ROTATE_CACHE.put(img, cacheByAngle = new HashMap<>()); 899 899 } 900 900 -
trunk/src/org/openstreetmap/josm/tools/ImageResource.java
r6316 r7005 25 25 * Caches the image data for resized versions of the same image. 26 26 */ 27 private Map<Dimension, Image> imgCache = new HashMap< Dimension, Image>();27 private Map<Dimension, Image> imgCache = new HashMap<>(); 28 28 private SVGDiagram svg; 29 29 public static final Dimension DEFAULT_DIMENSION = new Dimension(-1, -1); -
trunk/src/org/openstreetmap/josm/tools/MultiMap.java
r5822 r7005 22 22 private final Map<A, Set<B>> map; 23 23 24 /** 25 * Constructs a new {@code MultiMap}. 26 */ 24 27 public MultiMap() { 25 map = new HashMap< A, Set<B>>();28 map = new HashMap<>(); 26 29 } 27 30 31 /** 32 * Constructs a new {@code MultiMap} with the specified initial capacity. 33 * @param capacity the initial capacity 34 */ 28 35 public MultiMap(int capacity) { 29 map = new HashMap< A, Set<B>>(capacity);36 map = new HashMap<>(capacity); 30 37 } 31 38 … … 38 45 Set<B> vals = map.get(key); 39 46 if (vals == null) { 40 vals = new LinkedHashSet< B>();47 vals = new LinkedHashSet<>(); 41 48 map.put(key, vals); 42 49 } … … 64 71 Set<B> vals = map.get(key); 65 72 if (vals == null) { 66 vals = new LinkedHashSet< B>(values);73 vals = new LinkedHashSet<>(values); 67 74 map.put(key, vals); 68 75 } … … 93 100 public Set<B> getValues(A key) { 94 101 if (!map.containsKey(key)) 95 return new LinkedHashSet< B>();102 return new LinkedHashSet<>(); 96 103 return map.get(key); 97 104 } … … 161 168 @Override 162 169 public String toString() { 163 List<String> entries = new ArrayList< String>(map.size());170 List<String> entries = new ArrayList<>(map.size()); 164 171 for (A key : map.keySet()) { 165 172 entries.add(key + "->{" + Utils.join(",", map.get(key)) + "}"); -
trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java
r6362 r7005 32 32 private static final String STATUS_BAR_ID = "multikeyShortcut"; 33 33 34 private Map<MultikeyShortcutAction, MyAction> myActions = new HashMap< MultikeyShortcutAction,MyAction>();34 private Map<MultikeyShortcutAction, MyAction> myActions = new HashMap<>(); 35 35 36 36 private class MyKeyEventDispatcher implements KeyEventDispatcher { -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r7004 r7005 44 44 } 45 45 String[] args = url.substring(i+1).split("&"); 46 HashMap<String, String> map = new HashMap< String, String>();46 HashMap<String, String> map = new HashMap<>(); 47 47 for (String arg : args) { 48 48 int eq = arg.indexOf('='); … … 146 146 final String shortLink = url.substring(SHORTLINK_PREFIX.length()); 147 147 148 final Map<Character, Integer> array = new HashMap< Character, Integer>();148 final Map<Character, Integer> array = new HashMap<>(); 149 149 150 150 for (int i=0; i<SHORTLINK_CHARS.length; ++i) { … … 229 229 double y = Math.floor((1 - Math.log(Math.tan(Math.toRadians(lat)) + 1 / Math.cos(Math.toRadians(lat))) / Math.PI) 230 230 / 2 * Math.pow(2.0, zoom)); 231 return new Pair< Double, Double>(x, y);231 return new Pair<>(x, y); 232 232 } 233 233 -
trunk/src/org/openstreetmap/josm/tools/Pair.java
r6156 r7005 44 44 45 45 public static <T> ArrayList<T> toArrayList(Pair<T, T> p) { 46 ArrayList<T> l = new ArrayList< T>(2);46 ArrayList<T> l = new ArrayList<>(2); 47 47 l.add(p.a); 48 48 l.add(p.b); … … 71 71 */ 72 72 public static <U,V> Pair<U,V> create(U u, V v) { 73 return new Pair< U,V>(u,v);73 return new Pair<>(u,v); 74 74 } 75 75 } -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r6889 r7005 148 148 // create a shortcut object from an string as saved in the preferences 149 149 private Shortcut(String prefString) { 150 List<String> s = (new ArrayList< String>(Main.pref.getCollection(prefString)));150 List<String> s = (new ArrayList<>(Main.pref.getCollection(prefString))); 151 151 this.shortText = prefString.substring(15); 152 152 this.longText = s.get(0); … … 232 232 233 233 // here we store our shortcuts 234 private static Map<String, Shortcut> shortcuts = new LinkedHashMap< String, Shortcut>();234 private static Map<String, Shortcut> shortcuts = new LinkedHashMap<>(); 235 235 236 236 // and here our modifier groups 237 private static Map<Integer, Integer> groups= new HashMap< Integer, Integer>();237 private static Map<Integer, Integer> groups= new HashMap<>(); 238 238 239 239 // check if something collides with an existing shortcut … … 252 252 */ 253 253 public static List<Shortcut> listAll() { 254 List<Shortcut> l = new ArrayList< Shortcut>();254 List<Shortcut> l = new ArrayList<>(); 255 255 for(Shortcut c : shortcuts.values()) 256 256 { … … 299 299 Main.platform.initSystemShortcuts(); 300 300 // (2) User defined shortcuts 301 LinkedList<Shortcut> newshortcuts = new LinkedList< Shortcut>();301 LinkedList<Shortcut> newshortcuts = new LinkedList<>(); 302 302 for(String s : Main.pref.getAllPrefixCollectionKeys("shortcut.entry.")) { 303 303 newshortcuts.add(new Shortcut(s)); -
trunk/src/org/openstreetmap/josm/tools/TaggingPresetNameTemplateList.java
r6362 r7005 25 25 return instance; 26 26 } 27 private final List<TaggingPreset> presetsWithPattern = new LinkedList< TaggingPreset>();27 private final List<TaggingPreset> presetsWithPattern = new LinkedList<>(); 28 28 29 29 private TaggingPresetNameTemplateList() { -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r6830 r7005 58 58 Map<String, String> getFreeParsedTags() { 59 59 String k, v; 60 Map<String, String> tags = new HashMap< String,String>();60 Map<String, String> tags = new HashMap<>(); 61 61 62 62 while (true) { … … 164 164 String[] lines = text.split(splitRegex); 165 165 Pattern p = Pattern.compile(tagRegex); 166 Map<String, String> tags = new HashMap< String,String>();166 Map<String, String> tags = new HashMap<>(); 167 167 String k=null, v=null; 168 168 for (String line: lines) { -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7004 r7005 122 122 123 123 public static <T> Collection<T> filter(Collection<? extends T> collection, Predicate<? super T> predicate) { 124 return new FilteredCollection< T>(collection, predicate);124 return new FilteredCollection<>(collection, predicate); 125 125 } 126 126 … … 142 142 */ 143 143 public static <S, T extends S> SubclassFilteredCollection<S, T> filteredCollection(Collection<S> collection, final Class<T> klass) { 144 return new SubclassFilteredCollection< S, T>(collection, new Predicate<S>() {144 return new SubclassFilteredCollection<>(collection, new Predicate<S>() { 145 145 @Override 146 146 public boolean evaluate(S o) { … … 523 523 */ 524 524 public static <T> List<T> topologicalSort(final MultiMap<T,T> dependencies) { 525 MultiMap<T,T> deps = new MultiMap< T,T>();525 MultiMap<T,T> deps = new MultiMap<>(); 526 526 for (T key : dependencies.keySet()) { 527 527 deps.putVoid(key); … … 533 533 534 534 int size = deps.size(); 535 List<T> sorted = new ArrayList< T>();535 List<T> sorted = new ArrayList<>(); 536 536 for (int i=0; i<size; ++i) { 537 537 T parentless = null; … … 906 906 public static List<String> getMatches(final Matcher m) { 907 907 if (m.matches()) { 908 List<String> result = new ArrayList< String>(m.groupCount() + 1);908 List<String> result = new ArrayList<>(m.groupCount() + 1); 909 909 for (int i = 0; i <= m.groupCount(); i++) { 910 910 result.add(m.group(i)); -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r6906 r7005 66 66 67 67 private class Parser extends DefaultHandler { 68 Stack<Object> current = new Stack< Object>();68 Stack<Object> current = new Stack<>(); 69 69 StringBuilder characters = new StringBuilder(64); 70 70 … … 186 186 boolean onStart; 187 187 boolean both; 188 private final Map<String, Field> fields = new HashMap< String, Field>();189 private final Map<String, Method> methods = new HashMap< String, Method>();188 private final Map<String, Field> fields = new HashMap<>(); 189 private final Map<String, Method> methods = new HashMap<>(); 190 190 191 191 public Entry(Class<?> klass, boolean onStart, boolean both) { … … 226 226 } 227 227 228 private Map<String, Entry> mapping = new HashMap< String, Entry>();228 private Map<String, Entry> mapping = new HashMap<>(); 229 229 private DefaultHandler parser; 230 230 … … 232 232 * The queue of already parsed items from the parsing thread. 233 233 */ 234 private List<Object> queue = new LinkedList< Object>();234 private List<Object> queue = new LinkedList<>(); 235 235 private Iterator<Object> queueIterator = null; 236 236 -
trunk/src/org/openstreetmap/josm/tools/template_engine/Condition.java
r6986 r7005 8 8 public class Condition implements TemplateEntry { 9 9 10 private final List<TemplateEntry> entries = new ArrayList< TemplateEntry>();10 private final List<TemplateEntry> entries = new ArrayList<>(); 11 11 12 12 public List<TemplateEntry> getEntries() { -
trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java
r4817 r7005 66 66 } 67 67 68 List<OsmPrimitive> result = new ArrayList< OsmPrimitive>();68 List<OsmPrimitive> result = new ArrayList<>(); 69 69 for (OsmPrimitive child: children) { 70 70 for (OsmPrimitive parent: child.getReferrers(true)) { … … 100 100 parents = Collections.emptyList(); 101 101 } 102 List<OsmPrimitive> result = new ArrayList< OsmPrimitive>();102 List<OsmPrimitive> result = new ArrayList<>(); 103 103 for (OsmPrimitive p: parents) { 104 104 if (p instanceof Way) { … … 137 137 @Override 138 138 List<OsmPrimitive> getPrimitives(OsmPrimitive root) { 139 List<OsmPrimitive> result = new ArrayList< OsmPrimitive>();139 List<OsmPrimitive> result = new ArrayList<>(); 140 140 for (OsmPrimitive o: lhs.getPrimitives(root)) { 141 141 if (condition == null || condition.match(o)) { … … 168 168 @Override 169 169 List<OsmPrimitive> getPrimitives(OsmPrimitive root) { 170 List<OsmPrimitive> result = new ArrayList< OsmPrimitive>();170 List<OsmPrimitive> result = new ArrayList<>(); 171 171 List<OsmPrimitive> lhsList = lhs.getPrimitives(root); 172 172 for (OsmPrimitive o: rhs.getPrimitives(root)) { -
trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java
r4546 r7005 39 39 40 40 private TemplateEntry parseExpression(Collection<TokenType> endTokens) throws ParseError { 41 List<TemplateEntry> entries = new ArrayList< TemplateEntry>();41 List<TemplateEntry> entries = new ArrayList<>(); 42 42 while (true) { 43 43 TemplateEntry templateEntry;
Note:
See TracChangeset
for help on using the changeset viewer.