/home/caleb/ASDV-WebDev/Semester 2/Assignments/lab_EL5_CalebFontenot/src/main/java/edu/slcc/asdv/beans/LambdaAction.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/JSF/JSFManagedBean.java
package edu.slcc.asdv.beans;
import jakarta.el.ELContext;
import jakarta.el.LambdaExpression;
import jakarta.inject.Named;
import jakarta.enterprise.context.RequestScoped;
import jakarta.faces.context.FacesContext;
import java.util.ArrayList;
@Named(value = "lambdaAction")
@RequestScoped
public class LambdaAction {
public LambdaAction() {
}
public Object lambda1(LambdaExpression lambdaExpression) {
FacesContext fc = FacesContext.getCurrentInstance();
ELContext elContext = fc.getELContext();
return lambdaExpression.invoke(elContext, 8, 3);
}
public ArrayList<String> lambda2(LambdaExpression lambdaExpression) {
ArrayList<String> returnArray = new ArrayList<>();
returnArray.add(lambdaExpression.invoke(1,2,3,4).toString());
returnArray.add(lambdaExpression.invoke(2,1,3,4).toString());
returnArray.add(lambdaExpression.invoke(2,3,1,4).toString());
returnArray.add(lambdaExpression.invoke(4,2,3,1).toString());
returnArray.add(lambdaExpression.invoke(4,2,1,1).toString());
returnArray.add(lambdaExpression.invoke(4,1,1,2).toString());
returnArray.add(lambdaExpression.invoke(1,1,4,2).toString());
returnArray.add(lambdaExpression.invoke(1,1,1,1).toString());
return returnArray;
}
}