English 中文(简体)
我怎么能够把我掌握的那片map图分开,并获取信息?
原标题:How can I split the hashmap I have and get the information?
  • 时间:2023-01-30 19:32:35
  •  标签:
  • java
  • hashmap

我有这样的投入产出。 这一产出中指标Info最多可包含三个要素。 我要谈谈其中的前三个内容。 因此,我要向屏幕上打印entertainment_ interest_f, Citizen_s,tv_ interest_f变量和数值。 我如何能够这样做?

CollectiveInterestsRes(
                            targetInfo=[{entertainment_interest_f=3.0}, {citizenship_s->America=3.0}, {tv_interest_f=3.0}],
                            msisdnCount=3,
                            msisdnList=[495012072622, 495012103468, 495012115405],
                            isSuccess=true,
                            ruleRequests=[RuleRequest(ruleId=tv, subruleId=null, locationRequest=null, operator=EQ, values=[1], msisdnRequest=null)]
                        )

课程内容如:

public class CollectiveInterestsRes {
        private List<Map<String,String>> targetInfo;
    
        private Integer gsmNoCount;
        private List<String> gsmNoList;
        private boolean isSuccess;
        private List<RuleRequest> ruleRequests;
    }

我能够打破这一方法,你们能否帮助我更多?

List<Map<String, String>> targetInfo = collectiveInterestsRes.get(0).getTargetInfo();
最佳回答

除了证明你所具备的这种微薄的cra结构外,你所能做的事情是把所有内容放在一个共同地图上。 然后,关键内容的准入

final List<Map<String, String>> targetInfo = collectiveInterestsRes.get(0).getTargetInfo();
final Map<String, String> accumulatedMap = new HashMap<>();

targetInfo.forEach(accumulatedMap::putAll);

System.out.println(accumulatedMap.get("tv_interest_f"));
System.out.println(accumulatedMap.get("entertainment_interest_f"));
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签