jmc430
asked on
Removing Item from Array List
Greetings!
I'm having some trouble with my code .. I am trying to suppress the repetitions of a department name in an array list.
I am setting a boolean within the if statement, to set isDUPLICATE=false when deps.equals(depL.departmen tName())
However, whenever I set the boolean, it sets it for the entire function, rather than just within the if statement ..
Basically, I would like it to only be set for the conditional when the criteria is met .. and I want the boolean to be reset to true afterwards (in order to show the rest of the list of depts). I have NSLOg.out.appendln(Printf) statements everywhere showing the correct boolean values, but for some reason all the values being returned on my HTML page are all either true or false, instead of set as particular to the values in my printf statements.
Please help!
This is my relevant code:
public NSArray getAllDepartments(){
if (results.count()==2){
Department depFirst = (Department)a.objectAtInde x(0);
Department depLast = (Department).b.objectAtInd ex(1);
if (!(depFirst .divisionName().equals(dep Last .divisionName())){
if((deps!=null)&&(deps.equ als(depLas t .departmentName())){
isDUPLICATE=false;
}
deps=(depLast.departmentNa me());
NSArray originalListWithDuplicates =ms.allObj ects();
EOSortOrdering ordering1=new EOSortOrdering("department Name", EOSortOrdering.CompareAsce nding);
NSMutableArray sortOrdering=new NSMutableArray();
sortOrdering.addObject(ord ering1);
return EOSortOrdering.sortedArray UsingKeyOr derArray(o riginalLis tWithDupli cates,sort Ordering);
}
}
}
I'm having some trouble with my code .. I am trying to suppress the repetitions of a department name in an array list.
I am setting a boolean within the if statement, to set isDUPLICATE=false when deps.equals(depL.departmen
However, whenever I set the boolean, it sets it for the entire function, rather than just within the if statement ..
Basically, I would like it to only be set for the conditional when the criteria is met .. and I want the boolean to be reset to true afterwards (in order to show the rest of the list of depts). I have NSLOg.out.appendln(Printf)
Please help!
This is my relevant code:
public NSArray getAllDepartments(){
if (results.count()==2){
Department depFirst = (Department)a.objectAtInde
Department depLast = (Department).b.objectAtInd
if (!(depFirst .divisionName().equals(dep
if((deps!=null)&&(deps.equ
isDUPLICATE=false;
}
deps=(depLast.departmentNa
NSArray originalListWithDuplicates
EOSortOrdering ordering1=new EOSortOrdering("department
NSMutableArray sortOrdering=new NSMutableArray();
sortOrdering.addObject(ord
return EOSortOrdering.sortedArray
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)
ASKER
=)