Searching two different elements in a same list I have a list of conversion histories, where information about user channels is stored. For example user may have app for iOS and Android installed. Each time user logs in, I store a conversion history, so that there might be multiple rows with shared data (e.g. client is always iOS).

I need to get the latest usage of iOS and Android in this case, as you can see code is pretty much in 'serial' way, so I wonder how this part can be optimized. Any help is appreciated.

private List&lt;UserChannel.AppUser&gt; findLatestAppClients(
            List&lt;Conversion&gt; conversions
    ) {
        Optional&lt;Conversion&gt; iosClient =
                conversions.stream().filter(c -&gt; IOS.clientName().equals(c.getClient())).findFirst();

        Optional&lt;Conversion&gt; androidClient =
                conversions.stream().filter(c -&gt; ANDROID.clientName().equals(c.getClient())).findFirst();

        List&lt;UserChannel.AppUser&gt; appUsers = new ArrayList&lt;&gt;();

        if (iosClient.isPresent()) {
            appUsers.add(new UserChannel.AppUser(iosClient.get().getClient(), iosClient.get().getClientId()));
        }

        if (androidClient.isPresent()) {
            appUsers.add(new UserChannel.AppUser(androidClient.get().getClient(), androidClient.get().getClientId()));
        }

        return appUsers;
    }
There's no problem with the performance. Java 8 filtering actually doesn't scan the whole stream, so the processing will be done only until the first element meeting the predicate is hit. So you're fine this way. However, I would do a bit of refractoring here:

private List&lt;UserChannel.AppUser&gt; findLatestAppClients(
            List&lt;Conversion&gt; conversions) {
    Optional&lt;Conversion&gt; iosClient = findFirstWithName(IOS.clientName());

    Optional&lt;Conversion&gt; androidClient = findFirstWithName(ANDROID.clientName());

    List&lt;UserChannel.AppUser&gt; appUsers = new ArrayList&lt;&gt;();

    addIfPresent(appUsers, iosClient);

    addIfPresent(appUsers, androidClient);

    return appUsers;
}

private Optional&lt;Conversion&gt; findFirstWithName(String name){
    return conversions.stream().filter(c -&gt; name.equals(c.getClient())).findFirst();
}

private void addIfPresent(List&lt;UserChannel.AppUser&gt; appUsers, Optional&lt;Conversion&gt; conversion){
    if (conversion.isPresent()) {
        appUsers.add(new UserChannel.AppUser(conversion.get().getClient(), 
            conversion.get().getClientId()));
    }
}