简体   繁体   中英

How to remove an item from ArrayList<HashMap<String, Object>>

I'm using an ArrayList<HashMap<String, Object>> to store items in. I know how to add an item to this list, but I don't know how to remove one. I've tried many things, such as list.remove(position); but nothing was working. I've searched on Google and read tons of similar questions which didn't help me at all. My question is: How to remove an item from the list?

My list:

[
    { title=MyFirstElement, comments=First element of my list },
    { title=ASecondOne, comments=Two elements },
    { title=Third, comments=Never two without three }
]

Could you please post the complete stacktrace. The eror you have mentioned is not relate to what you think. Its something relates to Json.

In general,

list.remove(index)

should work in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM