Skip to content
Advertisement

Tag: list

How to use arrayList sort and manipulate the vlaue

By using Java 11, I am trying to find the average value inside the ArrayList. The algorithm i want to develop is ((value inside list/maximum value)*100)/length of list). I got number format runtime error while I run the program. java.lang.NumberFormatException is the error i got. enter image description here Answer I find two issues with the code above: The parsing

How to i iterate and compare two lists

Here I’m trying to compare two lists position wise that is the first element from list1 has to be compared with only the first element of list2 and if they are equal it should be replaced with the empty string in the output list and if they are different the element in the second list has to be updated in

Converting to List result in Java

I have the following method: In this method, I pass a single menuUuid and then get combination of a single MenuPropertiesDTO and List<GroupExpDTO>. I want to pass a List<menuUuid> instead of a single menuUuid and then get the result according to the uuids in this list. However, I am confused if there is a proper way for this in Java.

How to randomize ArrayList without using Collections.swap()?

I was asked to create a method that randomly rearranges my list which contains arrays. The list contains multiple persons and their names and surnames. My question is how do I move a person (array containing two elements name and surname inside the list) to a different index without using the method swap()? Because our list does not support that

Append list according to their size in Java

I am trying to append two list according to their size. With list with bigger size in front. I have few lists like this. List<Pair<Double, String>> masterList = new ArrayList<>(); and this is the working Java code that I tried first – with a simple if else loop: I am fairly new to the Java, so I was studying about

Merge an List of Object and an Object to a new array in Java [closed]

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 10 months ago. Improve this question I have List<BigInteger> sample1 = Lists.newArrayList(BIGINTEGER1, BIGINTEGER2,BIGINTEGER3); I have to create new List sample2 with one more value BIGINTEGER4 along with sample1 list: How can

Advertisement