Home > Back-end > Stream flow inside the null pointer
Stream flow inside the null pointer
Time:05-01
List Collect=objects. Stream (). The map (Student: : getId). Collect (Collectors. ToList ()); To ask you, the method how to avoid null pointer !Such as the back with the query, select * from table where id in (collect) is wrong
CodePudding user response:
List Collect=objects. Stream (). The filter (objects: : nonNull). The map (Student: : getId) Filter (Objects: : nonNull). Collect (Collectors. ToList ());