I am new to java. In java i can see that int and Integer are different. int is primitive and Integer is class. I have done following code.
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Builder
public class Student {
private Integer roleNo;
private String name;
private String city;
public static void main(String[] args) {
// TODO Auto-generated method stub
List<Student> lstStudent = new LinkedList<Student>();
lstStudent.add(new Student(111, "aaa", "Moon"));
lstStudent.add(new Student(333, "ccc", "Sun"));
lstStudent.add(new Student(222, "bbb", "Jupiter"));
List<Student> sortedStudents = lstStudent.stream().sorted(Comparator.comparing(Student::getRoleNo))
.collect(Collectors.toList());
System.out.println(sortedStudents);
}
}
I have given breakpoint at sortedstudent
list and I can see that I am getting all the values but I am not getting integer value. It shows as 'Integer' ......... why?
Am I missing some key concept here?