Deleting all occurrences in a circular linked list. (java)

I want to implement a method that deletes all occurences of a certain value given as argument. I created 2 temporary elements and referenced them to the head and I will be browsing the list using them….

How can I accept an argument list in a constructor and add it to a collection in Java?

I’m trying to make a constructor that would accept any number of variables of class “Item” as a variable argument list and add them to appropriate collection. What would be the best way to …

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 { protected T data; protected Node next, prev; } class DoublyLinkedList> { …

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. …