From [here](http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html), there's a way to get the value of a nested [Optional](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html) or a default value:

```
Optional<Computer> maybeComputer = Optional.of(computer);
String version = maybeComputer.flatMap(Computer::getSoundcard).flatMap(Soundcard::getUsb).map(USB::getVersion).orElse("UNKNOWN");

```

or

```
Computer computer = ...;
String version = computer.getSoundcard().flatMap(Soundcard::getUsb).map(USB::getVersion).orElse("UNKNOWN");

```

**BUT, how do I get all the versions of all collection's computers?** - `List<Computer>`

For example, how can I print all the USB versions, using `stream` API, **including the ones that are `unknown`**?

or

How can I map all the computers to their soundcard's USB version, including the `unknown` ones?

Thanks.

Computer class:

```
public static class Computer {
    private Optional<Soundcard> soundcard;

    public Computer(Optional<Soundcard> soundcard) {
        this.soundcard = soundcard;
    }

    public Optional<Soundcard> getSoundcard() {
        return soundcard;
    }
}

public static class Soundcard {
    private Optional<USB> usb;

    public Soundcard(Optional<USB> usb) {
        this.usb = usb;
    }

    public Optional<USB> getUsb() {
        return usb;
    }
}

public static class USB {
    private String version;

    public String getVersion() {
        return version;
    }
}

```