Skip to main content

All Questions

Tagged with
0 votes
1 answer
38 views

how to return numbers by column from objects that have array list attribute

I have a class where I am creating different "Processes", an attribute of this class is an linked list of Integers. I have created different class objects and to make it easy to loop through ...
javaloaf's user avatar
-1 votes
1 answer
46 views

deleting duplicate objects from an arraylist

I have an array list consisting of objects defined in the class Result(date, name, grade). I have managed to sort the dataset. However I want there to be no duplicates, only the object with that has ...
zara's user avatar
  • 1
0 votes
1 answer
314 views

Ordering array of objects alphabetically by name, data fetched from API

I am fetching data(a contact list: name, email, phone, etc)from API. The mapping is done and I can see the list of names displayed but now I want them in alphabetical order from a-z. I am trying this ...
dannuzak's user avatar
  • 109
0 votes
1 answer
133 views

How to sort ArrayList of objects by alphabetical order of property

I have an ArrayList of People, with every person having their names or ages. So, I'll be adding new people to this ArrayList and I want to sort it alphabetically. For example: ArrayList<Person> ...
Oto's user avatar
  • 111
0 votes
1 answer
90 views

How does the sorting of ArrayList of custom object works?

How does this list.sort() method is actually sorting the objects according to their property. This is a solution for a LeetCode question 1337. class Solution { public int[] kWeakestRows(int[][] mat, ...
Sanket's user avatar
  • 11
2 votes
1 answer
38 views

Sort ArrayList by diffrent parameters which are in an object [duplicate]

I have an Class "Person" which contains a constructor with 3 parameters. Now i want a sorting option, i need it to sort by ID, Name, or Address ascending and descending public class Person { private ...
Darko Ivanovic's user avatar
-2 votes
1 answer
45 views

Problem with using compareTo with an arrayList

I am trying to write a program to analyze and interpret GIS data. I have the program completely coded out but am running into issues when I try to use a compareTo to sort the program on different ...
Toby Z's user avatar
  • 31
0 votes
1 answer
59 views

How to sort two object arraylists?

Far a game I need two sort an object arraylist (Room.enemies) on the speed attribute and player object with it's speed attribute so I can know in which order I need to run the attack methods. For ...
Jami Saueressig's user avatar
0 votes
2 answers
56 views

Sorting through an array list of objects

I am trying to read data in from a CSV file containing 4 columns to an array list. Let's call the columns a,b,c,d (They each contain integers). Then I would like to sort the array list according to ...
Abby 's user avatar
0 votes
1 answer
38 views

Sorting an ArrayList object populated with custom objects with two data fields each

stuck on a problem with sorting ArrayLists. I'm sure the answer is really easy and something I just keep overlooking, but I've been working on this for the past many hours straight and just need ...
Cheyko's user avatar
  • 41
0 votes
2 answers
639 views

Java - Sorting Objects in an ArrayList<Car> based on MPG

I am having issues (using a modified version of SelectionSort) to sort the ArrayList of Car objects from lowest MPG to greatest MPG. Here is my code: public ArrayList<Car> getSortedByMPG(){ ...
Daniel's user avatar
  • 41
-1 votes
2 answers
162 views

Sorting 2D Arraylist of Object

I have 2D Arralist of Object and i want to sort it upon first column which contains LocalDate i used this code to sort it DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d/M/yyyy"); ...
user1814596's user avatar
-1 votes
1 answer
83 views

Sorting an an ArrayList of Objects in Java

I have an object that holds an int value, a String, and a double. Instances of that object are stored in an ArrayList. I want to print that object now but I want to first sort the ArrayList by the ...
OVOFan's user avatar
  • 15
-2 votes
2 answers
1k views

JAVA ArrayList sort and remove pairs

I am trying to write a small card game and have become stuck I created a class Deck and in it an arraylist of objects, each object represents 1 card in a playing deck comprised of a String suit, ...
calKooLator's user avatar
-2 votes
1 answer
58 views

Shuffle only one variable of objects in arraylist

I have an arraylist filled with objects of a class. These objects have variables like x,y and a imagePath. I only want to shuffle the imagepath variables in this arraylist between the objects. So x- ...
user7432713's user avatar

15 30 50 per page