**Objective:** `List<User>` for each User dto I want to return only *id* and *name*

Format should be like:

```
[
 {
  "id": 1,
  "name": "ruben"
 },
 {
  "id": 2,
  "name": null
 }
] 

```

**My Attempt:** 

```
List<Users> userList = null;
    Map<String, String> resultMap=new HashMap<>();
    try {
        userList = userRepository.findAllUserTitle();
        userList.parallelStream().forEach(p->{

            resultMap.put("id", String.valueOf(p.getId()));
            resultMap.put("title", p.getTitle());
        });

```

**Note:** Is it possible to achieve this using streams flatmaps or any other solution please provide also I don't want to create any other dto.