java 数组去重复
{"deviceid":"460001204101325","distance":0.0,"maxspeed":0.0,"runningtime":"0秒"},{"deviceid":"460001204101325","distance":10.8,"maxspeed":42.0,"runningtime":"45分26秒"},
{"deviceid":"460001204101325","distance":15.0,"maxspeed":66.0,"runningtime":"26分30秒"},
{"deviceid":"460001204101325","distance":15.5,"maxspeed":55.0,"runningtime":"29分12秒"},
{"deviceid":"4609320402424","distance":35.2,"maxspeed":74.0,"runningtime":"1时42分27秒"},
{"deviceid":"4609320402424","distance":4.9,"maxspeed":25.0,"runningtime":"30分24秒"},
{"deviceid":"460706130100567","distance":0.0,"maxspeed":0.0,"runningtime":"0秒"},{"deviceid":"460706130100567","distance":88.6,"maxspeed":85.0,"runningtime":"1时22分3秒"},{"deviceid":"460706130100805","distance":26.4,"maxspeed":64.0,"runningtime":"50分59秒"},
把上面的数据只要deviceid是一样的都只取一个,后面的参数相加弄成下面这种的{"deviceid":"460001204101325","distance":41.3,"maxspeed":66.0,"runningtime":"1时31分08秒"},
{"deviceid":"4609320402424","distance":40.1,"maxspeed":74.0,"runningtime":"2时12分51秒"},
{"deviceid":"460706130100567","distance":88.6,"maxspeed":85.0,"runningtime":"1时22分3秒"},{"deviceid":"460706130100805","distance":26.4,"maxspeed":64.0,"runningtime":"50分59秒"},这个怎么弄????
------解决方案--------------------
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
public class JSonTest {
public static void main(String[] args) {
// 初始化JSON字符串数组// 这里的字符串,双引号是特殊字符,需要做转义处理
String[] jsonStrArr = {
"{\"deviceid\":\"460001204101325\",\"distance\":0.0,\"maxspeed\":0.0,\"runningtime\":\"0秒\"}",
"{\"deviceid\":\"460001204101325\",\"distance\":10.8,\"maxspeed\":42.0,\"runningtime\":\"45分26秒\"}",
"{\"deviceid\":\"460001204101325\",\"distance\":15.0,\"maxspeed\":66.0,\"runningtime\":\"26分30秒\"}",
"{\"deviceid\":\"460001204101325\",\"distance\":15.5,\"maxspeed\":55.0,\"runningtime\":\"29分12秒\"}",
"{\"deviceid\":\"4609320402424\",\"distance\":35.2,\"maxspeed\":74.0,\"runningtime\":\"1时42分27秒\"}",
&nb