i have a code like these
@Data
public class person{
String firstName;
String lastName;
int orderNum;
}
List<person> personList = new ArrayList<person>();
i am trying to sort object and trying get map based on order number.
i wrote a logic these this and didn't work for me
Map<String, String> xza = personList.stream()
.sorted(Comparator.comparing(refDataDto::getOrderNum))
.collect(Collectors.toList())
.stream()
.collect(Collectors.toMap(refDataDto::getFirstName, refDataDto::getastName));