Here is my Model. I want to display all users except "peter". Here is my code:
//iterating through all the values in database
for (DataSnapshot postSnapshot : snapshot.getChildren()) {
User user= postSnapshot.getValue(User.class);
if (user.getUsername()!="peter"){
users.add(user);}
}
//creating adapter
adapter = new MyAdapter(getApplicationContext(), users);
//adding adapter to recyclerview
recyclerView.setAdapter(adapter);
problem: my list still displays the user Peter!!