public class Vanilla {
public static void main(String[] args) {
List<Student> students = Collections.emptyList();
students.add(new Student("Pedro", 30));
students.add(new Student("João", 25));
Predicate<Student> p = s -> s.name == "Pedro";
Vanilla v = new Vanilla();
}
public List<Student> vanilla(List<Student> students, Predicate<Student> p, Function<Student, Student> f) {
List<Student> result = Collections.emptyList();
boolean over = false;
while(!over) {
List<Student> sub = auxState.subList(0, auxState.size());
if(p.test(auxState.get(0))) {
result.add(f.apply(auxState.get(0)));
}
auxState = sub;
}
return result;
}
public List<Student> withFStream(List<Student> students, Predicate<Student> p, Function<Student, Student> f) {
return Collections.emptyList();
}
An exception occurs:
java.util.EmptyStackException
at java.base/java.util.Stack.peek(Stack.java:102)
at java.base/java.util.Stack.pop(Stack.java:84)
at lang.jimple.internal.Decompiler$InstructionSetVisitor.returnIns(Decompiler.java:1269)
When we try to decompile this code:
An exception occurs: