Source:
<code>private void writeAugmentationApplicationsMetaData(Map<String, Set<String>> applications) { int applicationsSize = applications.size(); List<String> applicationNames = new ArrayList<>(applications.keySet()); writeMetaData("augmentationApplications", applicationNames.toArray(new String[applicationsSize])); Label defaultLabel = new Label(); Label[] labels = new Label[applicationsSize]; int[] keys = new int[applicationsSize]; String[][] namesArrays = new String[applicationsSize][]; <START> Collections.sort(applicationNames, new Comparator<String>() { <END> @Override public int compare(String o1, String o2) { return Integer.compare(o1.hashCode(), o2.hashCode()); } }); int i = 0; for (String applicationName : applicationNames) { labels[i] = new Label(); keys[i] = applicationName.hashCode(); namesArrays[i] = applications.get(applicationName).toArray(new String[applications.get(applicationName).size()]); i++; } methodVisitor = classWriter.visitMethod( ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC, "$augmentationApplications", "(I)[Ljava/lang/String;", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(ILOAD, 0); methodVisitor.visitLookupSwitchInsn(defaultLabel, keys, labels); for (i = 0; i < applicationsSize; i++) { methodVisitor.visitLabel(labels[i]); loadInteger(methodVisitor, namesArrays[i].length); methodVisitor.visitTypeInsn(ANEWARRAY, "java/lang/String"); for (int j = 0; j < namesArrays[i].length; j++) { methodVisitor.visitInsn(DUP); loadInteger(methodVisitor, j); methodVisitor.visitLdcInsn(namesArrays[i][j]); methodVisitor.visitInsn(AASTORE); } methodVisitor.visitInsn(ARETURN); } methodVisitor.visitLabel(defaultLabel); loadInteger(methodVisitor, 0); methodVisitor.visitTypeInsn(ANEWARRAY, "java/lang/String"); methodVisitor.visitInsn(ARETURN); methodVisitor.visitMaxs(0, 0); methodVisitor.visitEnd(); }</code><technical_language>A lambda for readability</technical_language>

Target:
private void writeAugmentationApplicationsMetaData(Map<String, Set<String>> applications) { int applicationsSize = applications.size(); List<String> applicationNames = new ArrayList<>(applications.keySet()); writeMetaData("augmentationApplications", applicationNames.toArray(new String[applicationsSize])); Label defaultLabel = new Label(); Label[] labels = new Label[applicationsSize]; int[] keys = new int[applicationsSize]; String[][] namesArrays = new String[applicationsSize][]; Collections.sort(applicationNames, (o1, o2) -> Integer.compare(o1.hashCode(), o2.hashCode())); int i = 0; for (String applicationName : applicationNames) { labels[i] = new Label(); keys[i] = applicationName.hashCode(); namesArrays[i] = applications.get(applicationName).toArray(new String[applications.get(applicationName).size()]); i++; } methodVisitor = classWriter.visitMethod( ACC_PUBLIC | ACC_STATIC | ACC_SYNTHETIC, "$augmentationApplications", "(I)[Ljava/lang/String;", null, null); methodVisitor.visitCode(); methodVisitor.visitVarInsn(ILOAD, 0); methodVisitor.visitLookupSwitchInsn(defaultLabel, keys, labels); for (i = 0; i < applicationsSize; i++) { methodVisitor.visitLabel(labels[i]); loadInteger(methodVisitor, namesArrays[i].length); methodVisitor.visitTypeInsn(ANEWARRAY, "java/lang/String"); for (int j = 0; j < namesArrays[i].length; j++) { methodVisitor.visitInsn(DUP); loadInteger(methodVisitor, j); methodVisitor.visitLdcInsn(namesArrays[i][j]); methodVisitor.visitInsn(AASTORE); } methodVisitor.visitInsn(ARETURN); } methodVisitor.visitLabel(defaultLabel); loadInteger(methodVisitor, 0); methodVisitor.visitTypeInsn(ANEWARRAY, "java/lang/String"); methodVisitor.visitInsn(ARETURN); methodVisitor.visitMaxs(0, 0); methodVisitor.visitEnd(); }