Skip to content

Commit

Permalink
changes arrayList to the more general List where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Medrano Fernandez authored and Ana Medrano Fernandez committed Feb 12, 2024
1 parent e68b770 commit 87a4313
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import formflow.library.pdf.SingleField;
import formflow.library.pdf.SubmissionField;
import formflow.library.pdf.SubmissionFieldPreparer;
import java.util.List;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -20,7 +20,7 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio

Map<String, Object> inputData = submission.getInputData();

ArrayList<String> programs = (ArrayList) inputData.get("programs[]");
List<String> programs = (List) inputData.get("programs[]");

if (programs.isEmpty()) {
return results;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
import formflow.library.data.Submission;

import java.util.ArrayList;

import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.mdbenefits.app.data.enums.HelpNeededType;
import org.mdbenefits.app.utils.ApplicationUtilities;
import org.springframework.stereotype.Component;

/**
*
* This method stores the program associated with the help needed so that the field appears checked on the choose programs page.
*/
@Component
@Slf4j
public class PreCheckPrograms implements Action {

@Override
public void run(Submission submission) {
ArrayList<String> helpNeeded = (ArrayList<String>) submission.getInputData().get("helpNeeded[]");
ArrayList<String> programsToAdd = new ArrayList<>();
List<String> helpNeeded = (List<String>) submission.getInputData().get("helpNeeded[]");
List<String> programsToAdd = new ArrayList<>();

helpNeeded.forEach((String need) -> {
if(need.equals(HelpNeededType.NOT_SURE.name())){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

public class ApplicationUtilities {
public static Set<String> flattenHouseholdNeedsPrograms(ArrayList<String> needTypes) {
ArrayList<ArrayList<String>> relevantPrograms = new ArrayList<>();
List<List<String>> relevantPrograms = new ArrayList<>();

needTypes.forEach((String programType) -> {
relevantPrograms.add(HelpNeededType.getRelevantProgramsFromName(programType));
});

return relevantPrograms.stream()
.flatMap(ArrayList::stream)
.flatMap(List::stream)
.collect(Collectors.toSet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2 th:text="#{choose-programs.check-all-that-apply}"></h2>
th:with="shortDesc=${programType.getShortDescSrc().isBlank()} ? '' : #{${programType.getShortDescSrc()}}"
th:utext="${shortDesc}">
</h2>
<th:block class="font-weight--normal"
<th:block
th:replace="~{fragments/inputs/checkboxInSet:: checkboxInSet(
inputName='programs',
value=${programType.name()},
Expand Down

0 comments on commit 87a4313

Please sign in to comment.