android - Java: True If statement in a For loop is causing the loop to break, but not executing the block -
this first posting here, have done quite bit of research before writing. i'm attempting compare strings using string.equals()
, , (with right data) comparing evaluating true
. threw in boolean check it. however, instead of executing contents of if block, exits loop , returns null:
public weatherinfo getweather (date date, arraylist<weatherinfo> weather) { simpledateformat sdf = new simpledateformat("mmm dd yyyy"); string eventdate = sdf.format(date); (weatherinfo w : weather) { date wdate = new date(w.getepoch() * 1000); string weatherdate = sdf.format(wdate); if (weatherdate.equals(eventdate)) { homecoming w; } } homecoming null; }
anyone have thought cause happen?
ps. here's screenshot of relevant variables @ time of true evaluation (test check boolean)
java android
No comments:
Post a Comment