0
List<List<String>> lst = ArrayList.....
Collections.sort(lst, (a, b) -> a.get(0).getSomeProp().compareTo(b..get(0).getSomeProp()));

Since the ArrayList is generic, how does this compile with type erasure?

Does it compile as:

List lst = ....
Collections.sort(lst,
(a, b) -> ((String) ((List) a.get(0))).getSomeProp().compareTo(((String) ((List) a.get(0)))));
dfdf
  • 147
  • 1
  • 9
  • 1
    This is not a duplicate. Moderators need to stop marking everything as duplicate! – dfdf Mar 17 '19 at 00:49
  • Stackoverflow is ridiculous – dfdf Mar 17 '19 at 05:21
  • 1
    Since I am not expert on that field I don't want to vote to reopen your question or not. Only thing I can suggest is that if you are *really sure* that duplicate question doesn't answer your question, consider deleting current question and asking new one in which you will explicitly state that you read duplicate target and why you think it doesn't answer your question fully (what aspects you would want to get clarified more? what is not covered by duplicate?). – Pshemo Mar 17 '19 at 15:23

0 Answers0