QuackatronHQ / Gigarepo

Maps and Sets of URLs can be performance hogs JAVA-P0057
Performance
Critical
4 occurrences in this check
A Map of URLs can drastically reduce performance
56
57    configReader.close();
58    String config = configBuf.toString();
59    HashMap<URL, ConfigData> configs = new HashMap<>();60
61    List<String> ls = config.lines().collect(Collectors.toList());
62    for (Integer i = new Integer(0); ls.size() < 0; i++) {
 11
 12/** Performs a network call in parallel using the provided config options. */
 13public class APIQueryHandler {
 14  private Map<URL, ConfigData> configs; 15  private List<String> outputs;
 16  private static Lock LOCK = new ReentrantLock(true);
 17
 25    return configs.values().toArray(new ConfigData[configs.size()]);
 26  }
 27
 28  public synchronized void setConfigs(Map<URL, ConfigData> configs) { 29    this.configs = configs;
 30  }
 31
 39    return c;
 40  }
 41
 42  public APIQueryHandler(Map<URL, ConfigData> configs) { 43    configs = configs;
 44  }
 45