Trying to use POJO in Key but unable to find match Any issue with current methodolgy How can I solve this?
public class test {
  public static void main(String a[]){`enter code here`
    HashMap<model, String> hm = new HashMap<model, String>();
    //add key-value pair to hashmap
    List<model> lm=new ArrayList<>();
   lm.add(new model(1,"1"));
   lm.add(new model(2,"2"));
   hm.put(lm.get(0), "1");
    System.out.println("Start");
    if (hm.containsKey(lm.stream().filter(person->person.name.equals("1")
            &&
            person.rollNo.equals(1)).findFirst())) {
        System.out.println("hit");
    }
}
static class  model{
    private Integer rollNo;
    private String name;
    @Override
    public boolean equals(Object obj) {
    model   modeltemp= (model)obj;
    if (modeltemp.name.equals(name)&& modeltemp.rollNo.equals(rollNo)) {
        return true;
    }
        return super.equals(obj);
    }
    public Integer getRollNo() {
        return rollNo;
    }
    public void setRollNo(Integer rollNo) {
        this.rollNo = rollNo;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public model(Integer rollNo, String name) {
        super();
        this.rollNo = rollNo;
        this.name = name;
    }
}
}
 
     
    