I just wanted to know if I need to place a check for null at Point A below. Will it ever be null at that point? Or will it only be empty/non-empty?
Thx in advance for any help!
List myList = new ArrayList();
PreparedStatement ps = null;
ResultSet rs = null;
String sql ="SELECT * FROM XXXXX";
ps = getDBConnection.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
//Add the row to myList using myList.add...
}
if (myList != null){ //POINT A
//Implement some logic
}
..
Your
ArrayListis just a reference. It could in principle point tonull, of course. In your example, however, you directly assign it to anew ArrayList()and nothing changesmyListin between so, no, it can never be null