I created a Map like so:
private Vector vaildateTestScore(String persTestCode, String score, List<TSpecialTest> specialTestList, Vector errorVtr) {
Map<String, TSpecialTest> specialTestmap = new HashMap<String, TSpecialTest>();
for (TSpecialTest specialTest : specialTestList) {
specialTestmap.put(persTestCode,specialTest);
}
if (specialTestList.get(persTestCode).getPersTestScrQyMin() < score){
errorVtr.add(specialTestList.get(persTestCode)+" max range is "+" "+specialTestList.get(persTestCode).getPersTestScrQyMax());
System.out.println("There was an error with > "+specialTestList.get(persTestCode).getPerTestTypeCd());
}
else if(specialTestList.get(persTestCode).getPersTestScrQyMax() > score){
errorVtr.add(specialTestList.get(persTestCode).getPerTestTypeCd()+" min range is "+" "+specialTestList.get(persTestCode).getPersTestScrQyMin());
System.out.println("There was an error with < "+specialTestList.get(persTestCode).getPerTestTypeCd());
}
return errorVtr;
}
However where ever you see persTestCode my IDE shows a runtime error saying: get(int) in List cannot be applied to java.lang.String
This class is set up by calling the following at the beginning of the class like so:
SpecialTestImpl specialTest = ComponentBuilder.getInstance().getApplicationContext().getBean(SpecialTestImpl.class);
List<TSpecialTest> specialTestList = specialTest.specialTestList();
Then the method is called like so:
String persTestCode = elem.replace("scr.", "");
String score = request.getParameter(elem);
Vector errorVtr = new Vector();
//validates inputted test scores
vaildateTestScore(persTestCode, score, specialTestList,errorVtr);
--------------------SOLVED--------------------------------
This was a comlete oversite on my side. The tab button and the name similarity got the best of me. This is what I am trying to do.
private Vector vaildateTestScore(String persTestCode, String score, List<TSpecialTest> specialTestList, Vector errorVtr) {
Map<String, TSpecialTest> specialTestmap = new HashMap<String, TSpecialTest>();
for (TSpecialTest specialTest : specialTestList) {
specialTestmap.put(persTestCode,specialTest);
}
if (specialTestmap.get(persTestCode).getPersTestScrQyMax() > Integer.parseInt(score)){
errorVtr.add(specialTestmap.get(persTestCode)+" max range is "+" "+specialTestmap.get(persTestCode).getPersTestScrQyMax());
System.out.println("There was an error with > "+specialTestmap.get(persTestCode).getPerTestTypeCd());
}
else if(specialTestmap.get(persTestCode).getPersTestScrQyMax() > Integer.parseInt(score)){
errorVtr.add(specialTestmap.get(persTestCode).getPerTestTypeCd()+" min range is "+" "+specialTestmap.get(persTestCode).getPersTestScrQyMin());
System.out.println("There was an error with < "+specialTestmap.get(persTestCode).getPerTestTypeCd());
}
return errorVtr;
}
persTestCodeafterelem.replace("scr.", "")represents an integer value?