user1435913
user1435913

Reputation:

Understanding &lt and &gt

I'm looking this site. I can't understand what this means:

private ArrayList<HashMap<String, String>> data;

Please, explain this to me.

Thanks

Upvotes: 8

Views: 38809

Answers (3)

Mayura
Mayura

Reputation: 1949

That is blog post error in HTML encoding,

  • &lt; = < (Less than)
  • &gt; = > (Greaterthan)

Code should actually look like private ArrayList<HashMap<String, String>> data;

You should be able to decode such HTML Encoding from here (htmlspecialchars_decode).

Upvotes: 1

Rikki
Rikki

Reputation: 3528

It's Generic templates that also java supports. Think that without Generics how you can declare such a thing like this.

It might be like this:

HashMap table = new HashMap();

ArrayList arr = new ArrayList();

arr.Add(table);

With Generics, instead of working with objects and casting or converting (late-bounding), you can write is as easy as possible. Like you mentioned:

private ArrayList<HashMap<String, String>> data;

and work with the declared variable so easier.

Cheers

Upvotes: 0

Benissimo
Benissimo

Reputation: 1012

Those are html entities:

&lt; -> <
&gt; -> >

Those characters have to be escaped in html because they are used to start and end html tags:

<p>, <b>, etc.

So the string you asked about, with html entities replaced, is:

Private ArrayList<HashMap<String, String>> data;

Those html entities were left in the code snippet on the site you mentioned, most likely by mistake or else due to a bug in how that site escapes code snippets.

Upvotes: 21

Related Questions