problems with google code prettify for printing java code having code like List<Map<String,Object>>

98 Views Asked by At

I'm trying to print below line on html page:

List<Map<String,Object>> someVar = someMethod();

however, in html Map<String,Object> is being treated as tag in html

Below is the output I'm getting:

List> someVar = someMethod();

everything else other than Map is being properly replaced by span tags

enter image description here

2

There are 2 best solutions below

1
suvojit_007 On BEST ANSWER

replace < by &lt; and > by &gt;

List&lt;Map&lt;String,Object&gt;&gt; someVar = someMethod();
0
Davidwestcoast On

try inserting \r right after the <

<script> document.write("List <\rMap<\rString,Object>> someVar = someMethod();"); </script>

the result I got was: List < Map< String,Object>> someVar = someMethod();