Search code examples
listcollectionsmultiple-value

How to save two values into a single variable fetched from a list in java


    List<Issue> issues = issueSearcher.get().getAppropriateIssues();

From the above line of code I will be getting two values. 1. Project 2. count

How to save these two values in a single variable? with collections or any other concepts


Solution

  • You can use HashMap for storing the first value 'Project' as key and second value 'count' as value. Split the value returned by your query and put to hashmap.

    HashMap<String, Integer> resultMap = new HashMap<String, Integer>();