Accessing key/value pair in ArrayList<LinkedHashMap>

Object Value

Above is the evaluate expression in Intellij of an Object field. I want to access both key and value but unable to do so.

Answers


You need to iterate over your list, here is an example

public static void main(String[] args){
    List<LinkedHashMap<String,String>> list = new ArrayList<LinkedHashMap<String, String>>();

    LinkedHashMap<String, String> test = new LinkedHashMap<String, String>();
        test.put("a","1");
        test.put("b","2");

    list.add(test);

    for(Map<String, String> map : list){
        for(String key : map.keySet()){
            System.out.println("key: " + key + " value " + map.get(key));
        }
    }

}

Need Your Help

What is the difference between self-modifying code and reflection?

reflection computer-science self-modifying

Self-modifying code is code that "alters its own instructions while it is executing". This is not typically done outside of assembly language or viruses.

Getting the value of TbSelect2

yii yii-booster

how to get the value of bootstrap.widgets.TbSelect2

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.