我将ArrayList作为以下示例: -
<Data><No1><time>16:32</time><Number>2</Number></No1><No2><time>14:32</time><Number>3</Number></No2></Data>
如何根据时间获得时间值16:32。我不想使用子字符串。任何想法都可以基于关键时间来获得价值。
提前致谢。
答案 0 :(得分:1)
使用HashMaps Se this link for details
答案 1 :(得分:0)
//try this way
1. you need "ArrayList<LinkedHashMap<String,String>> data = new ArrayList<LinkedHashMap<String, String>>()" for data
2. your each LinkedHashMap have two key "time" and "number'
3. now one by one store each data item in LinkedHashMap and add each LinkedHashMap to "ArrayList<LinkedHashMap<String,String>> data"
4 now access data whatever you want using "ArrayList<LinkedHashMap<String,String>> data" get index wise LinkedHashMap again get value LinkedHashMap key.
**Note** LinkedHashMap - is store sequential data and HashMap - is store unsequential