I have a list which can have different values like this

```
("name=xyz", "age=10", "birth=1995", "gender=male")

```

I am only interested in `age` and `birth` fields here. Above is one record. There are multiple such records and some of them can have either age or birth or both or none.

So to find age of the person I do something like this:

```
recordValues.stream().filter(entry -> entry.matches("age") || entry.matches("birth"))
                        .map(entry -> {
                            if (entry.matches("age")) {
                               // parse age and return age as no. of days
                            }
                            else {
                              // parse year and return age as no. of days
                            }
                        })

```

Is there any way to avoid this `if else` or make it more clear? I am just looking for a cleaner code.