I have a list of objects (Slack Bolt framework), one of them is appended dynamically upstream and then passed in an array list. I need to fetch out this key (it looks like this: status_block_EPOCH
) but when I try to filter I get undefined in the evaluate expression in IntelliJ. I am trying something like this:
Map<String, Map<String, ViewState.Value>> blockValues = viewSubmissionRequest.getPayload().getView().getState().getValues();
blockValues.keySet().stream().filter(s -> s.startsWith("status_block")
That should give me the key that matches this (i.e. status_block_123646484568
) that I can use but I cant get it to work for some reason. What am I doing wrong here?
Hope you are you collecting the filtered values in this manner?
List<String> keys = blockValues.keySet().stream().filter(s -> s.startsWith("status_block")).collect(Collectors.toList());
Now, this keys
list will contain your key.
This part was missing in the question, so I could not be sure.