Q:

How to join strings lists with the same value in a list

I have a list of a list of strings, and I need to join the values that are the same into a single list and add the different values of each list.
For example:
List <String> listA = ["A", "B", "C"];
List <String> listB = ["A", "B", "D"];
List <String> listJ = ["J, K"];
List <String> listz = ["z"];

the joined list would be like this:
List <String> listJoin = ["A", "B", "C","D"];

and the result should be:
List <List <String>> resultList = [listJoin, listJ, listz];

This is data that comes from a json, maybe I should not use String List.
Any suggestions will be welcome.

A:

You can have joined list by:
List listJoin = (listA + listB).toSet().toList();

