Sitemap

Amicuk Programming Answers

Sorting of mutiple level in java object.

-0001-11-30   Views:0

Advertisement

Hi I have to sort a Arraylist containg similar type Java bean object which have following attributes. Name Age Salary Now I have to implement a sorting for these objects within ArrayList. I have implemented 1st level of sorting on Name using comparat

Hi
I have to sort a Arraylist containg similar type Java bean object which have following attributes.
Name
Age
Salary
Now I have to implement a sorting for these objects within ArrayList.
I have implemented 1st level of sorting on Name using comparator interfaces.
But I have arrived a situation where more than 1 person can have similar name.
In this case I have to further sort my records based on Age and then if required based on Salary.
How can I achieve this.
Please comment.
Thanks

The replay answer
Advertisement
In your comparator, check if the Name is equal, if it 's, check to see if the Ages are equal, if not, compare on their Age. If the Age is also the same, compare on the Salary.

Go to See the other 6 answers

Sorting of mutiple level in java object.

Category:DefaultRelease time:-0001-11-30Views:130

Hi I have to sort a Arraylist containg similar type Java bean object which have following attributes. Name Age Salary Now I have to implement a sorting for these objects within ArrayList. I have implemented 1st level of sorting on Name using comparat[More]

Comparing java object trees

Category:DefaultRelease time:-0001-11-30Views:130

Hello. I was wondering if someone might have some advice or ideas about this seemingly very common problem. I have two copies of a very large java object tree (original and modified). I need to compare these two trees and figure out whether any data[More]

Select Sorting at prompt level

Category:DefaultRelease time:2015-10-11Views:130

Hi,    How to select sorting parameter from prompt level?  I have followed the thread [Select Sorting in prompt level  |Re: Select Sorting in prompt level;. I got struck while creating " Prompt - Sort Order" object. How to do this? Regards, Mali[More]

How to create new java objects in native methods?

Category:DefaultRelease time:2015-10-11Views:130

Hello, Is it possible to create java objects and return the same to the java code from a native method? Also is it possible to pass java objects other than String objects (for example, Vector objects) as parameters to native methods and is it possibl[More]

How to store java objects in the database

Category:DefaultRelease time:2015-10-11Views:130

Hi, I am trying to store HttpSession state across Application Servers. Basically I am trying to build a sort of application cluster server on my own. I thought the best way to do this was to periodically store the HttpSession object from an applicati[More]

JAXB - Marshalling populated Java object into XML

Category:DefaultRelease time:-0001-11-30Views:130

I have a populated Java object that I'd like to marshall to an xml file. I don't instantiate this object from a DTD, nor do I need to generate the object via unmarshalling an xml. I'm just trying to build something akin to a toXML() method for this o[More]

2 TopLink Java Object from Table to be used in single selectOneChoice

Category:DefaultRelease time:-0001-11-30Views:130

Hello everyone, can I ask for help on how to solve my problem.... Here's my scenario, I have 2 tables namely tblCollege and tblCourse, they are related through tblCourse.CollegeCode = tblCollege.Code. I use the jdeveloper wizard using TopLink -> Java[More]

Writing java object into file

Category:DefaultRelease time:-0001-11-30Views:130

Dear Experts, What is the best way to write java objects into file 1. Using Object Output Stream or 2.Using ByteArray OutputStream with Thanks PanneerDear Experts, What is the best way to write java objects into file 1. Using Object Output Stream or[More]

How to generate Java objects from XML files with out  scema compilation

Category:DefaultRelease time:-0001-11-30Views:130

Dear participants, My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of[More]

Need example in basic level of java..

Category:DefaultRelease time:-0001-11-30Views:130

can anyone give me an example of how to count the frequency of numbers occur and how to sort the numbers in ascending order? output: Numbers before sort: 1,3,2,1,1,1,3,4 Numbers after sort: 1,2,3,4 Frequency: 4,1,2 p/s: i'm a beginner to java program[More]

Generation of XML file from Java objects using castor

Category:DefaultRelease time:2015-10-11Views:130

I have the following java file(Customer.java). public class Customer      private String ID;      private FirstName firstName;      private MiddleName middleName;      private LastName lastName;      private ArrayList address;      public ArrayList g[More]

Hot
My question is simlilarly based to the previous discussion https://discussions.apple.com/message/15134714#15134714 What I need to do is display the number of days until I have to reset a flight condition (FS Column) based on a set number of days (60 [More]
I have been trying to run gnome 3.16 for quite some time now, but every time at login I get a "oh no, something has gone wrong" I just cannot narrow down to what is causing the problem. I've tried with xorg 1.16 and xorg 1.17 Catalyst 14.8 and 1 [More]
I updated my mac yesterday to Maverick and now Adobe Photoshop CS5 won't launch.  Can you tell me what files I need to delete to get it to launch.  I tried reinstalling it, and that didn't help. thanksIt's very strange.  When I try to double click on [More]
Dear archlinux community, i decided to give arch a try as my linux server os, however i've run into the following issue when attempting to install samba: [[email protected] ~]$ sudo pacman -S samba avahi [sudo] password for silver: resolving dependenc [More]
When i try to verify my ssd in disk utility, The following pop up appears Your computer may be slow or unresponsive while the startup disk is being verified. When i click verify disk It then says performing live verification in live mode. What is liv [More]
I have a question on how NAT pools, or sNAT works with ACE in one-arm mode. As I understand it, when the client sends the request to ACE, it changes the destination IP to a rServer and source IP to the sNAT address.  When the rServer responds, it sen [More]
I love this effect, but cannot figure out how they made these darker brown lines around their tables (kind of a whisked broken up lines) around their tables. I have tried every brush tool and effect I could think of, but know need to ask the experts! [More]
Just got RH 7; how do I import my X5 project into RH 7?Welcome to our community, jcalix Well it's a long and arduous process fraught with high adventure and mystery. If you are up to the task and not faint of heart: Backup old project. Open RoboHelp [More]
I have found what appears to be a bug. Has anyone else encountered this bug. I have the following code: Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select columnA,columnB from tableA"); while (rs.next()) System.out [More]
payment information (type)  i cant bot my accont thers musj (contact itunes support to complete this transactionThen you need to contact iTunes Support. Click the Support tab above and you'll see a Contact Us area. Regards.Read other 2 answers [More]