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 have a recent problem with my internet connection. I have used the same computer (macbook) for 18 months in same address without other major problems; only change i can see have been the updates in the os X. I'm writing to these forums only because [More]
Hi All, I need to get the TagName of the Node immediete after the Root. I won't know what is the TagName, and based on the Tagname only I can process the records. For example I might receive a SALES object or a MARKETING object wrapped under the root [More]
Hi Guru's We got a requirement where by default we have to show calender year data, but when user selects fiscal year and he will be deselecting calender year we need to show fiscal year data. For above requirement we are using two prompts F_Year, C_ [More]
Dear fellow SAPers, I have created a product type of an OTC Option with specification: Product Category : OTC option Settlement : Cash Settlement Exercise Type : American Option Category : Standard assigned to it is transaction type with specificatio [More]
Hi everyone, My Reporting Service role is reporting an error "The report server service is not running on Reporting Service Point server "HQSVR5.CONTOSO.com"; start the service to enable reporting." I have researched about the error an [More]
I go to "Details" in the group message and pull down on the screen and nothing appears. Where is the custom group message field? Am I missing something?Hello there, rygar.maximus. The following Knowledge Base article offers up some great clarifi [More]
Helo! I've created a Single Folio app with 1526 articles. It works in the generic Adobe Content Viewer, but does not work on my custom App. It shutdowns after splash window. Could someone help me? ElismarChanging settings? What part of setting? My gu [More]
I deleted it but have heard it's hackers? Anything else I can do?Is this the one? http://itunes.apple.com/us/app/g-toolkit/id334208513?mt=8 Never heard of it, let alone used it. I'm not sure I'd want to give it my Google passwords, but I can't see an [More]
I need help from a person...  I bought this for educational reasons, it became handy when following the weather and such at home...  It disconnected from my home router, and I need help to reconnect it!  I don't remember how I did it, and I have no i [More]
I loaded 7.0 on a PC with XP. When it loads, only half the Photoshop window is visible and there is no scroll bar to allow access to the portion that is cut off. I've tried all of the options available under "properties" on the photoshop thumbna [More]