Need to filter 2 lists & add into seprate list in java -


i have 2 list:

  • avaliableroomtype - [standard, superdeluxe ]
  • wholeroomtype - [standard, superdeluxe, deluxe]

i need filter & add separate list unavailableroomtype - [deluxe]

for(int j = 0; j <  avaliableroomtype.size()  ; j++) {          for(int = 0; < wholeroomtype.size(); i++) {              string tempav = avaliableroomtype.get(j);             string temphotelroomid = wholeroomtype.get(i);              if(!tempav.equals(temphotelroomid)){               unavailableroomtype.add(temphotelroomid);               }          }      } 

but have duplicate values.

list<string> unavailableroomtype = new arraylist<>();  (string roomtype : wholeroomtype) {   if (!avaliableroomtype.contains(roomtype)) {     unavailableroomtype.add(roomtype);   } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -