Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question how to union 2 maps into one with collection in value this way it will override the value Answer
Tag: list
Combine two lists by ID
I have two lists of objects with contents that look like this: List A id = 1, name = “alex”, height = null, weight = 60 id = 2, name = “sara”, height = null, weight = 50 List B id …
Java: Round an Integer to an element of a given List
Supose i have a List of Integers: ints = {0,10,20,30,40,50} and an input value input = 17 How do i get the closest integer of the list to the given input? For my example it would be 20. Or to restate …
How do I work with objects in lists and can I create multiple objects with different names in a loop?
I need to create Objects of a class called “Tile”. I have 9×9 chess board like grid and want to initiate the whole board at once. The position of a Tile is defined by an x and y-axis and I …
Doubly Linked List QuickSort Implementation Problem
I’ve implemented a classic Doubly Linked List: class Node
Sort A List of an Object with other object’s method
In the bellow code, with such classes, how can I sort an ArrayList of Students by the score the got from Courses List? I mean how can I sort a List of a specific class by an attribute of this class which is a child of another class. Answer Your “Student” class is confusing. Based on the name, it sounds
Remove Alternate Elements from ArrayList in java 7
I have an array of String containing below elements 5.0,99,5.5,100,6.0,101 Now what I want to do I need to remove all the decimal value in string format like 5.0,5.5 and 6.0 so my final array should …
How to get list of months between two dates in Java
I am trying to get a list of months (actually the first days of those months) between two dates in Java but I am not getting the expected results. The start date is “3/17/2020”, the end date …
The value in LinkedHashMap cleared when I try to clear the object value (Java)
i got a problem when using LinkedHashMap. I try to store some value in it and then updated it. I’m using String for the key and List for the value. I put 2 value on the List and put them to …
Appending a string when find duplicate using stream
I do have a use case where i need to append a string(name) with version (name_version) which i will have in a model layer. But this is to be done only for the name which are duplicate in the list. …