Java Question List with Map

walterf25

Expert
Licensed User
Longtime User
Hello everyone, i need some help with something, I have the following code in Eclipse:

B4X:
  public List FindData(BA ba){
            IndexManager im = new IndexManager(ds);
            java.util.Map<String, Object> query = new HashMap<String, Object>();
            java.util.Map<String, Object> gt12 = new HashMap<String, Object>();
            gt12.put("$gt", 0);
            query.put("product_price", gt12);
          
            List list = new List();
            list.Initialize();
          
            QueryResult result = im.find(query);
          
            java.util.Map<String, Object>map1 = new HashMap<String, Object>();
            for (DocumentRevision revision : result) {
                Map map2 = new Map();   'B4A Map
                map2.Initialize();
                map1 = revision.getBody().asMap();   'Java.Util.Map
                for (Entry<String, Object> entry1 : map1.entrySet())
               
                {
                    map2.Put(entry1.getKey(), entry1.getValue());  
                }
                list.Add(map2);      'Add the map to a list
            }
          
            return list;
        }

the map that goes into the list looks something like this:

I want to be able to retrieve from the list for example the Product_Description, product_size etc....
the problem is that i get the following error:

Any ideas how to cast B4A Map to B4A MyMap or viceversa?

Thanks all!
Walter
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
Got it Erel, thanks that did the trick

Walter
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…