java - HashMap ContainsKey vs contains -
I have a scenario like the following.
I have a utility class with foll method.
Public Stable Maps & lt; String, string & gt; GetFeeList () {Map & lt; String, string & gt; Map = new hashmap & lt; String, string & gt; (); Map.put ("student list", "student list"); Map.put ("student grade", "student grade"); Return map; }
I am calling this method in JSP and calling it with another value like below,
Anything other than the feelist below the Mac Do not have class.getFeeList () to request and return to JSP.
& lt;% if (fee listingsmake containsKey (vo.getSubClassDesc ())) {%> & Lt; Td align = "center" & gt; 0 & lt; / Td> & Lt;%} else {% & gt; & Lt; Td align = "center" & gt; Test & lt; / Td> & Lt;%}% & gt; Some of the above vo.getSubClassDesc () may be suffixes like 'Student list as of today', 'Student list as last month' .... But the above check in JSP is considered only accurate key and 'Today As a student list 'Work done for' last month's student list 'I do not want to use substring here because the map can have more key values added and I do not want to use substrings at all times. Is that an easy way, where I can compare key values with subclassdesk which works like a string ()?
There is no direct method to do this in the Java classes underlying feeListsMap
object By looping on the key vo.getSubClassDesc (). In it, the key must be
.
s
Comments
Post a Comment