Skip to content

Commit 39cd82a

Browse files
committed
removed lambda expression
1 parent ab7afe2 commit 39cd82a

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/main/java/org/mdkt/compiler/InMemoryJavaCompiler.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Collection;
44
import java.util.HashMap;
5+
import java.util.Iterator;
56
import java.util.Map;
67

78
import javax.tools.JavaCompiler;
@@ -39,14 +40,14 @@ public void addSource(String className, String sourceCodeInText)
3940
public Map<String, Class<?>> compileAll() throws Exception {
4041
Collection<SourceCode> compilationUnits = clazzCode.values();
4142
CompiledCode[] code;
42-
code = compilationUnits.stream().map(in -> {
43-
try {
44-
return new CompiledCode(in.getClassName());
45-
} catch (Exception e) {
46-
throw new RuntimeException(e);
47-
}
48-
}).toArray(CompiledCode[]::new);
49-
43+
44+
code = new CompiledCode[compilationUnits.size()];
45+
Iterator<SourceCode> iter = compilationUnits.iterator();
46+
for (int i=0; i<code.length; i++)
47+
{
48+
code[i] = new CompiledCode(iter.next().getClassName());
49+
}
50+
5051
ExtendedStandardJavaFileManager fileManager = new ExtendedStandardJavaFileManager(
5152
javac.getStandardFileManager(null, null, null), classLoader, code);
5253
JavaCompiler.CompilationTask task = javac.getTask(null, fileManager,

0 commit comments

Comments
 (0)