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
I've this table in my database: [ode] phone ! model ! version ! count 123 abcd sis 1 234 asdfas sis 2 345 werwer jad 6 342 xcvxcv sis 3 678 jlkj jad 2 I want to display the the total number of count on my jsp page using jdbc connection. So, in this c [More]
I just had this reported to me.  When users go into a document repository and edit the properties after saving it DELETES THE FILE!!!!!!!!.  This just started happening so I have no clue.  No changes that I know of as of recent. First they get: Then [More]
Hi everybody! We are trying to find the way to complete the iimplementation for  the process of the iView Create Requisition Request. Does somebody have a customizing manual for the ECC System? Thanks in advance. Jesús.Dear Jesus, can you be more spe [More]
so a long time ago, I placed a call to hp and they told me how to disable the above message that kept scrolling across the printer display.  a while back i had to restore printer to defaults and this message is back and hp can't tell me how to turn i [More]
hi all. i'm very new to java and created a calculator applet now. in eclipse i can copmile and run it without problems as an applet, but i can't with IE. do i have to compile it to a special file, or can i just link the .java source code in the html [More]
Hello, I had selected "use all F1, F2, etc. keys as standard function keys". This preference was preserved through computer re-starts UNTIL I updated my OX to 10.5.5. (this system is not an option in the dropdown box below) Now when I restart my [More]
In Pages when I click the 'Sections'  button then click on the 1st page I get  a page that is titled "Lorem ipsum dolor sit amet"!  Where did it come from and how do I get rid of it? I have tried deleting and "dont save" but it comes b [More]
Hello, When we type "sh spanning-tree vlan X detail", then we have : - Number of topology changes : Y - Times.... topology changes : Z - Timers... topology changes : T Is Y the number fo TC in vlan X ? Is Z the number of TC in all vlans ? What a [More]
My iphone 5 refusing to play music , the moment i touch play sign it moves to next song but dont play it either just flipping to next song list. what to do? thanksI am just wondering if this worked? The same thing has happened to me - i got an iphone [More]
I get this message: There may be a problem with the mail server or network. Verify the settings for account "Icloud" or try again.  The server returned the error: The attempt to sendLikely you fotgot or put some port IN under advanced settings o [More]