Code example for ArrayList

Methods: addAll, size, toArray

0
    public Implementation(Config baseConfig, Config overlayConfig) {
      this.emulateSdk = pick(baseConfig.emulateSdk(), overlayConfig.emulateSdk(), -1);
      this.manifest = pick(baseConfig.manifest(), overlayConfig.manifest(), DEFAULT);
      this.qualifiers = pick(baseConfig.qualifiers(), overlayConfig.qualifiers(), "");
      this.reportSdk = pick(baseConfig.reportSdk(), overlayConfig.reportSdk(), -1);
      ArrayList<Class<?>> shadows = new ArrayList<Class<?>>();
      shadows.addAll(Arrays.asList(baseConfig.shadows()));
      shadows.addAll(Arrays.asList(overlayConfig.shadows()));
      this.shadows = shadows.toArray(new Class[shadows.size()]);
    } 
 
    private <T> T pick(T baseValue, T overlayValue, T nullValue) {
      return overlayValue.equals(nullValue) ? baseValue : overlayValue;
    } 
 
    @Override public int emulateSdk() { 
      return emulateSdk;
    } 
 
    @Override public String manifest() {
      return manifest;