Skip to content

Tag: collections

Rearrange substrings using two criteria [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 12 months ago. Improve this question Given a String: I need to sort its substrings first by numbers (in desce…

remove (and count) duplicates from a list

Is it possible to iterate between two iterators of a same list and remove an item within the nested iterator? Version 1 (does not work): } I get a java.util.ConcurrentModificationException, because I modify an element within the same iterator.. I can solve this issue by using another list removableItems and p…

Map a List to DTO inside map – java

I have such collection: Map<Integer, List<MyObject>> collection I would like to map the whole list of MyObject to MyObjectDTO and return the whole map with the mapped list. So return will be: Map<Integer, List<MyObjectDto>> collectionWithDtos What is the easiest and quickest way? I&#82…

Create a merged map with list of maps

I’m new to java so seeking help from experts. any help would be much appreciated, and a scope for me to learn new things. I want to create a List of maps(resultList) from a another list of maps(list) where a single map(keys) contains values which are keys to the list of maps(map1, map2, map3 … So …