Home > Back-end >  Java a key corresponding to the value in the Json data with multiple, how to remove duplicate elemen
Java a key corresponding to the value in the Json data with multiple, how to remove duplicate elemen

Time:09-16

,2,3,1 {" id ":" 1 ", "age" : "10,20,30,10", "number" : "1,2,3,1", "name" : "a, b, c, a"}

Want to remove duplicate value in each Key
The data, for example, to solve

CodePudding user response:

To get the value, String comma split into the set, don't go

CodePudding user response:

Behind the thought of cutting into the set can be don't know how to put the data back to the value of the

CodePudding user response:

Traverse the set spell values back bai, can also direct the toString it back

CodePudding user response:

Out on the Set is directly put into actually went

CodePudding user response:

refer to the second floor weixin_43756819 response:
thought of cutting on the set behind but don't know how to put the data back to the value of the
split apart to consider this question is very simple, to get the map and then traverse, then the value to heavy (can use the set), can again after the key and the value put into a set of new results map

CodePudding user response:


The
refer to the original poster weixin_43756819 response:
{" id ":" 1,2,3,1 ", "age" : "10,20,30,10", "number" : "1,2,3,1", "name" : "a, b, c, a"}

Want to remove duplicate value in each Key
This example data, solving




This you see, I didn't write the following method can general, each element to invoke this method returns the result of you to new a json object, to put it
  • Related