I'm trying to get working backend in Java for CRUD app. I am using Java 1.8. I used the following implementation of findByName(name) [below]. Intellij says that there is error, because "Cannot resolve method 'map' in 'List'". Does it means that Java does have map method? How can I overcome this. I have been trying to add before something like stream etc. but it does not help. I also would like to have device returned in findByName and with some tried solution the error was moving from map method to return device. I would be grateful for help, it is keeping me awake long in the night because I cannot finish.

```
return deviceRepository.findByName(name).map(device -> {
        LOG.info("Reading device with name " + name + " from database.");
        return device;
    }).orElseThrow(() -> new DeviceNotFoundException("The device with the name " + name + " couldn't be found in the database."));
}

```