CyclicBarrier and Thread for optimize for element for tags in Java
String elemento = "" ;


This variable is unused.

Additionally I'd clean up the blank lines you have, it's dangerous to have an if statement end, and then a couple blank lines later, there's an else that continues the if.

            for (int i = 2; i &lt; parts.length - 1; ++i) {
                String element = parts[1];
                String tag = parts[i];
                for (int j = 1; j &lt;= parts[i].length(); ++j) {
                    String tagPrefix = tag.substring(0, j);
                    Set&lt;String&gt; elements = map.get(tagPrefix);
                    if (elements == null) {
                        elements = new HashSet&lt;String&gt;();
                        map.put(tagPrefix, elements);
                    }
                    elements.add(element);
                }
            }


There's a performance optimization here; parts[i].length() is not free. Use final int tagLength = parts[i].length(), then test against that in your for-loop condition.