How to Convert Map to List in Java Example

Converting between HashMap and List is IMHO rarely reasonable. One of main purposes of List is to define order of its elements. The indices of such a List have no meaning because of potentially random order in HashMap. When one need to convert between HashMap and List in practical case, I guess one of these two structures is improperly chosen.Perhaps converting from LinkedHashMap or some kind SortedMap is little bit more sensible.Tomas Zalusky Hi Tomas, I see your point.First storing data into Map and than getting back into List where primary purpose of this two are different is very rare in real life project and your point towards LinkedHashMap makes much more sense in this context. Being a Java programmer and Software developer, I have learned a lot from articles titled as What Every Programmer Should Know about ..... ... Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 19, 2016 @ 12:02 am