[program-l] Java - alias for generic type

  • From: Lubos Pintes <lubos.pintes@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Thu, 27 Jun 2019 12:06:08 +0200

Hello Java geeks,

I have a question about some kind of type aliasing in Java. I am playing with manual JSON parsing, only exercise. I am representing JSON as Map<String, Object>. I am using LinkedHashMap. I would like to define a class JSON that would somehow extend LinkedHashMap<String, Object>, so that I could write:

JSON json=new JSON();

json.put("x", 1);

Is it possible?

Thanks


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: