Source:
<code>private Instance createInstance(String imageId, String machineId, String creator, String workspaceId, boolean isDev, String displayName, Recipe recipe, int memorySizeMB, LineConsumer outputConsumer) throws MachineException { try { final Map<String, String> labels; final Map<String, Map<String, String>> portsToExpose; final Set<String> volumes; if (isDev) { <START> labels = new HashMap<>(machineContainerLabels.size() + devMachineContainerLabels.size()); <END> labels.putAll(machineContainerLabels); labels.putAll(devMachineContainerLabels); portsToExpose = new HashMap<>(portsToExposeOnMachine.size() + portsToExposeOnDevMachine.size()); portsToExpose.putAll(portsToExposeOnMachine); portsToExpose.putAll(portsToExposeOnDevMachine); volumes = new HashSet<>(devMachineSystemVolumes.size() + systemVolumesForMachine.size() + 1); volumes.addAll(devMachineSystemVolumes); volumes.addAll(systemVolumesForMachine); } else { labels = machineContainerLabels; portsToExpose = portsToExposeOnMachine; volumes = systemVolumesForMachine; } final ContainerConfig config = new ContainerConfig().withImage(imageId) .withMemorySwap(-1) .withMemory((long) memorySizeMB * 1024 * 1024) .withLabels(labels) .withExposedPorts(portsToExpose); final String containerId = docker.createContainer(config, null).getId(); final DockerNode node = dockerMachineFactory.createNode(containerId); String hostProjectsFolder = node.getProjectsFolder(); if (isDev) { node.bindWorkspace(workspaceId, hostProjectsFolder); } if (isDev) { volumes.add(String.format("%s:%s", hostProjectsFolder, "/projects")); } HostConfig hostConfig = new HostConfig().withPublishAllPorts(true) .withBinds(volumes.toArray(new String[volumes.size()])); docker.startContainer(containerId, hostConfig, new LogMessagePrinter(outputConsumer)); return dockerMachineFactory.createInstance(machineId, workspaceId, isDev, creator, displayName, containerId, node, outputConsumer, recipe, memorySizeMB); } catch (IOException e) { throw new MachineException(e); } }</code><technical_language>do <code>Maps.newHashMapWithExpectedSize(...)</code> in this case</technical_language>

Target:
private Instance createInstance(String imageId, String machineId, String creator, String workspaceId, boolean isDev, String displayName, Recipe recipe, int memorySizeMB, LineConsumer outputConsumer) throws MachineException { try { final Map<String, String> labels; final Map<String, Map<String, String>> portsToExpose; final Set<String> volumes; if (isDev) { labels = Maps.newHashMapWithExpectedSize(machineContainerLabels.size() + devMachineContainerLabels.size()); labels.putAll(machineContainerLabels); labels.putAll(devMachineContainerLabels); portsToExpose = Maps.newHashMapWithExpectedSize(portsToExposeOnMachine.size() + portsToExposeOnDevMachine.size()); portsToExpose.putAll(portsToExposeOnMachine); portsToExpose.putAll(portsToExposeOnDevMachine); volumes = Sets.newHashSetWithExpectedSize(devMachineSystemVolumes.size() + systemVolumesForMachine.size() + 1); volumes.addAll(devMachineSystemVolumes); volumes.addAll(systemVolumesForMachine); } else { labels = machineContainerLabels; portsToExpose = portsToExposeOnMachine; volumes = systemVolumesForMachine; } final ContainerConfig config = new ContainerConfig().withImage(imageId) .withMemorySwap(-1) .withMemory((long) memorySizeMB * 1024 * 1024) .withLabels(labels) .withExposedPorts(portsToExpose); final String containerId = docker.createContainer(config, null).getId(); final DockerNode node = dockerMachineFactory.createNode(containerId); String hostProjectsFolder = node.getProjectsFolder(); if (isDev) { node.bindWorkspace(workspaceId, hostProjectsFolder); } if (isDev) { volumes.add(String.format("%s:%s", hostProjectsFolder, "/projects")); } HostConfig hostConfig = new HostConfig().withPublishAllPorts(true) .withBinds(volumes.toArray(new String[volumes.size()])); docker.startContainer(containerId, hostConfig, new LogMessagePrinter(outputConsumer)); return dockerMachineFactory.createInstance(machineId, workspaceId, isDev, creator, displayName, containerId, node, outputConsumer, recipe, memorySizeMB); } catch (IOException e) { throw new MachineException(e); } }