Changeset 8602 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-07-14T21:58:01+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r8574 r8602 46 46 import java.util.concurrent.ExecutorService; 47 47 import java.util.concurrent.Executors; 48 import java.util.concurrent.ThreadFactory; 48 49 import java.util.regex.Matcher; 49 50 import java.util.regex.Pattern; … … 1370 1371 * Returns the initial capacity to pass to the HashMap / HashSet constructor 1371 1372 * when it is initialized with a known number of entries. 1372 * 1373 * 1373 1374 * When a HashMap is filled with entries, the underlying array is copied over 1374 1375 * to a larger one multiple times. To avoid this process when the number of … … 1387 1388 * Returns the initial capacity to pass to the HashMap / HashSet constructor 1388 1389 * when it is initialized with a known number of entries. 1389 * 1390 * 1390 1391 * When a HashMap is filled with entries, the underlying array is copied over 1391 1392 * to a larger one multiple times. To avoid this process when the number of … … 1393 1394 * given to the HashMap constructor. This method returns a suitable value 1394 1395 * that avoids rehashing but doesn't waste memory. 1395 * 1396 * 1396 1397 * Assumes default load factor (0.75). 1397 1398 * @param nEntries the number of entries expected … … 1401 1402 return hashMapInitialCapacity(nEntries, 0.75f); 1402 1403 } 1404 1405 /** 1406 * @param name to be set for the threads 1407 * @return Thread Factory returning named threads 1408 */ 1409 public static ThreadFactory getNamedThreadFactory(final String name) { 1410 return new ThreadFactory() { 1411 @Override 1412 public Thread newThread(Runnable r) { 1413 Thread t = Executors.defaultThreadFactory().newThread(r); 1414 t.setName(name); 1415 return t; 1416 } 1417 }; 1418 } 1403 1419 }
Note:
See TracChangeset
for help on using the changeset viewer.