Is there a better way to present this code?
while (vIter.hasNext()) {
Long actId = (Long) vIter.next();
if (actId == -1)
vRetActIds.put(actId,"N");
else
vRetActIds.put(actId,"N");
}
Here I feel the if else can be made redundant. In the iterator list there is a value -1 which if exists should be made "N".
Your two instructions are the same on both sides of the if! I suspect you pasted something wrong. Let’s assume they’re different (
"Y"and"N") 🙂 You can write it simply using the ternary operator:EDIT: From your comments, it seems like you actually want to set the value to ‘N’ every time? In that case, you don’t need the
ifat all…