Map Character to Characters Most Frequently Found With it (in list of strings)
Here are some tips to keep in mind when writing code that needs to be optimal:


The single biggest thing is: reduce the time complexity! This is by far the most significant improvement you can possibly make. Avoid iterations over the data as much as possible. For instance, every time you check if the char was added to charMap, the containsKey() function iterates over data in the Map. There aren't many letters so you can have a small data structure where the position of the data (index) indicates what character it relates to, this will remove the need to iterate to search for a specific character. In other cases you may reduce the number of iterations by sorting your data and using an efficient search algorithm such as binary search.
Arrays are the fastest data structure, use them instead of more complex data structures wherever it makes sense to do so.
Minimize the amount of data to be stored/manipulated - this can too be achieved by position-coding the data in your data structure, the position where the numbers are saved tells you what character these numbers relate to, so there are no actual Character variables being created until you need to create them, and then you can write code that will create only the chars you need to use/output.


Here is my implementation of the function you were tasked to write, I also avoided some of the logic checks you did, but getting rid of a few if statements is not a significant optimization so don't worry about it, focus on the main points I explained and see how they are implemented.

(notice the difference caused by improving the time complexity: according to my benchmarking, my implementation works about as fast as yours (1.1 times faster) with an input of 3 strings in the list, but it works ~5.4 times faster than yours when given an input list of 30 strings, the speed gap grows the bigger the input gets)

public static Map&lt;Character, List&lt;Character&gt;&gt; companionChars(List&lt;String&gt; strings){
    Map&lt;Character, List&lt;Character&gt;&gt; result = new HashMap&lt;&gt;(27, 1);
    int[] lengths = {26, 26};
    int[][] companionCounts = (int[][]) Array.newInstance(int.class, lengths);

    for(String str : strings){
        int[] charsFound = new int[26];
        for(int x = 0; x &lt; str.length(); x++)
            charsFound[str.charAt(x) - 'a'] = 1;
        for(int x = 0; x &lt; 26; x++)
            if(charsFound[x] == 1){
                for(int y = 0; y &lt; 26; y++)
                    companionCounts[x][y] += charsFound[y];
                companionCounts[x][x]--;
            }
    }

    for(int x = 0; x &lt; 26; x++){
        ArrayList&lt;Character&gt; chars = new ArrayList&lt;Character&gt;();
        int max = 1;
        for(int y = 0; y &lt; 26; y++){
            if(companionCounts[x][y] &gt; max){
                max = companionCounts[x][y];
                chars.clear();
                chars.add((char)('a' + y));
            }
            else if(companionCounts[x][y] == max)
                chars.add((char)('a' + y));
        }
        if(!chars.isEmpty())
            result.put(new Character((char)('a' + x)), chars);
    }
    return result;
}


Main function:

public static void main(String args[]) {
    List&lt;String&gt; strings = Arrays.asList("aabc", "bcdddd", "cde");
    System.out.println(companionChars(strings));
}