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 had the networking day from ****. I previously had a 3rd Gen Time Capsule at our restaurant, connected to a Cisco 26port gigabit POE switch and Comcast digital voice and internet. Over the past few days, employees have reported trouble accessing [More]
I have voice-recorded a list of Italian words and phrases which I want to import into iTunes as separate tracks so that I can shuffle them & test myself to learn them. So far I have been using the cycle region to import each word but it is taking for [More]
How Can I create a HyperLink in JLabel ? is it possible ? plzz help ME..Do you want it to work, or just look like a hyperlink? I believe you can use html in a label by wrapping the text in <html></html> tags - e.g. JLabel myLabel = new JLabel( [More]
I want to create an expression for the following SQL statement: select distinct aCol from mytable where bCol = 123 and cCol = 'something'; My expression without using the distinct() is followed: Expression exp = new ExpressionBuilder().get("bcol" [More]
I've searched and searched and can not find a good example of how to do this. I've found many threads that pose the question with the only answer being something like "I figured it out, thanks anyway". My problem: I've got a tree, many nodes, ma [More]
os:HPUX11.23 db:ORACLE 10.2.0.2 SAP ECC6.0 The phase 'XPRA_EXECUTION' is terninated when I try to import SAP SEM-BW  PATCH "SAPKGS6012"   into ECC6.0 system. the erorr display as following: Short text Syntax error in program "/1BCDWBEN/SAPL [More]
Can I simply reinstall PSE7 from the original disk without risking the loss of slide shows and catalogs?  Have you tried finding the application and double clicking directly on it? It will be in the Program Files\Adobe folder and is named: PhotoshopE [More]
Hi all, I am deploying In Design CS5.5 (version 7.5) on several Windows 2008 R2 SP1 Citrix servers. The users login to the server and use the server desktop to run applications. For many apps we have used redirection for cache folders etc to try and [More]
Hi experts, I would like to know whether accessing jms queue in NetWeaver X from NetWeaver Y is possible or not using web application. I have one web application that is deployed in NetWeaver Y and I want to access jms queue in NetWeaver X (Not Y). I [More]
Hi I am having problems logging onto workspace and reporting studio..I have got 9.3.1 version installed on my laptop..Shared services is working properly.. I had been using the same "admin" and "password" for all of them..But, now a da [More]