storing hashMap in a hashMap

后端 未结 5 1174
孤街浪徒
孤街浪徒 2020-12-25 14:46

i am reading data from a text file and want to store HashMap in another HashMap..

HashMap>

how to

5条回答
  •  借酒劲吻你
    2020-12-25 15:34

    HashMap in HashMap will cause problems in readability especially when it goes beyond two levels. I assume that when you read data from a text file you want to categorize the inputs from rows and columns which should be similar to multi-level categories or category within a category. If you can post the sample data and your intention, I could come up with a Custom class example.

    public class Category {
      private List subCategories;
      private List items;
    }
    

    The above data structure will help you solve any level of nesting while categorizing data. This example is specific to a store items' classification.

提交回复
热议问题