Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to convert a List<String[]> of Subtitle Structure to HashMap<String, List<String[]>>
    primarykey
    data
    text
    <p>I have a table that show a Subtitle structure that was sorted in a right order from 1, 2, 3..... TitleID is unique.</p> <pre> TitleID - Title - Level - Order 451 - History - Level1 - 1 123 - History of America - Level2 - 2 465 - History of Cali - Level3 - 3 578 - History of NewYork - Level3 - 4 765 - History of Europe - Level2 - 5 754 - History of West Europe - Level3 - 6 </pre> <p>This table was converted into a <code>List&lt;String[]&gt;</code> of <code>{"451", "History", "Level1", "1" }</code>, <code>{"123", "History of America", "Level2", "2" }</code>... also in a right order.</p> <p>I want to convert this <code>List&lt;String[]&gt;</code> into a <code>HashMap&lt;String, List&lt;String[]&gt;&gt;</code>. If i do it manually it should be like this:</p> <pre><code>HashMap&lt;String, List&lt;String[]&gt;&gt; titleHashMap = new HashMap&lt;String, List&lt;String[]&gt;&gt;(); List&lt;String[]&gt; subTitleList=new ArrayList&lt;String[]&gt;; String[] titles1={"123", "History of America", "Level2"}; subTitleList.add(titles1); String[] titles12={"765", "History of Europe", "Level2"}; subTitleList.add(titles12); titleHashMap.put("451", subTitleList); List&lt;String[]&gt; subTitleList2=new ArrayList&lt;String[]&gt;; String[] titles2={"465", "History of Cali" , "Level3"}; subTitleList2.add(titles2); String[] titles21={"578", "History of NewYork", "Level3"}; subTitleList2.add(titles21); titleHashMap.put("123", subTitleList2); </code></pre> <p>But i don't want to do it manually, so how to do it automatically? Note: I also want a root level that parent of all Level1. Ex, <code>titleHashMap.put("root", subTitleListOfLevel1); </code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload