如何在数组列表的边对象中的对象中找到重复的json元素?

时间:2018-10-04 05:29:10

标签: java android hashmap

我有json数组ob对象列表,数组的列表名称是此数组中的值,我在值对象内部,我还有另一个称为归档的对象,我想访问归档的对象并找到重复的任何帮助?。 更新:我使用了System.out.println(“ a:” + Collections.frequency(stringList,“应收帐款”));方法,但是它总是让我为0

{
"",
"value": [
    {
        "@odata.etag": """,
        "createdDateTime": "",
        "eTag": """,
        "id": "",
        "lastModifiedDateTime": "",
        "webUrl": "",
        "createdBy": {
            "user": {
                "email": "",
                "id": "",
                "displayName": ""
            }
        },
        "lastModifiedBy": {
            "user": {
                "email": ",
                "id": "",
                "displayName": ""
            }
        },
        "parentReference": {},
        "contentType": {
            "id": ""
        },
        "fields@odata.context": "",
        "fields": {
            "@odata.etag": """,
            "id": "",
            "ContentType": "",
            "Modified": "",
            "Created": "",
            "AuthorLookupId": "",
            "EditorLookupId": "",
            "_UIVersionString": "",
            "Attachments": false,
            "Edit": "",
            "ItemChildCount": "0",
            "FolderChildCount": "0",
            "_ComplianceFlags": "",
            "_ComplianceTag": "",
            "_ComplianceTagWrittenTime": "",
            "_ComplianceTagUserId": "",
            "JobCategory": "",--> "check this value for duplicate"
            "Competency": "",
            "Level": "",
            "CompetencyType": "",
            "Index": "0",
            "FormID@odata.type": "",
            "FormID": 25
        }
    }]

在边值数组列表中有字段对象,但是尝试给定对象时,这里是我的代码。

   Set<Example> uniqueSet = new HashSet<Example>(borrowModelList);

            for (Example temp : uniqueSet) {


                txtInfo.setText(String.valueOf(Collections.frequency(borrowModelList,temp.getValue().get(0).getFields())));
                textInfoOne.setText(String.valueOf(Collections.frequency(borrowModelList,temp.getValue().get(0).getFields())));
                textInfoTwo.setText(String.valueOf(Collections.frequency(borrowModelList,temp.getValue().get(0).getFields())));
                textInfoThree.setText(String.valueOf(Collections.frequency(borrowModelList,temp.getValue().get(0).getFields())));
                textInfoFour.setText(String.valueOf(Collections.frequency(borrowModelList,temp.getValue().get(0).getFields())));
            }

I / System.out:1 在边字段对象中,有一个JobCategory字段,我只想检查一下并显示在textview上。

0 个答案:

没有答案