473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to sort an ArrayList of object depending on a field object

momotaro
357 Contributor
Hi,

having this class:
Expand|Select|Wrap|Line Numbers
  1. public class Field {
  2.  
  3.     private boolean isPersisted = true;
  4.     private String name;
  5.     private String type;
  6.     private String elements;
  7. ...
  8.     }
I have constructed an ArrayList of Field then I want to put objects with isPersisted set to false to the tail of my list

thank's in advance.
Aug 3 '11 #1
2 1944
momotaro
357 Contributor
would be great if you show me how to use treeSets
Aug 3 '11 #2
Dheeraj Joshi
1,123 Recognized Expert Top Contributor
You can use Comparator available in Java.
Create a comparator class for field object and try comparing.

Regards
Dheeraj Joshi
Aug 3 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3156
by: Lorenzo Bolognini | last post by:
Hi all, why is the DefinedSize of the Field object of type adInteger returning the value 4 and the same property on a adVarWChar type field (Text in MS Access) is returning the max length of the string that it may contain (for example 52)? I'm using ADO 2.8 Thank You,
2
1581
by: Danny | last post by:
HI, I am trying to do a group by such as this: "select code, colors from productdb group by code, colors" I need to sort on the key field, but cannot throw in the 'ordre by key', because i will get that 'not part of an aggregate function error' i could add it to the aggregate function, but it will return too many records as I just want...
3
2000
by: Bradley | last post by:
Hi I have an ArrayList populated with some objects. Each object has some properties, and I'd like to find the ArrayList's index where the object's "SerialNumber" property is equal to a certain integer. This doesn't seem as easy as using a regular Array's IndexOf() method, since I need to access the SerialNumber property of the object stored in...
0
1828
by: a | last post by:
I need to create an instance of a custom object 'School.Teacher' and use it in a Profile object. I'm developing a bad case of "Pretzel Logic" thinking about this. Filling the custom object 'School.Teacher' as an ArrayList creates the proper information (see aspx code below), but I'm unable to use this ArrayList in the Profile object....
1
2332
by: Nelly | last post by:
Please help! I am trying to sort a query by a field calculated as e.g. / I keep getting an error about subqueries not allowed for this type of expression, but only when I set to sort. I can sort by another calculated field of, for example just sum(), but not / and not
5
1469
by: blisspikle | last post by:
I figure that someone good at dotnet can look at this and give me a clue on how to easily organize this code? If there is a unique identifier like "Publisher" with a bunch of "Book" that are published under them (I used the arraylist class in the publisher class). How should the code be organized, and how can the books properties like...
20
13305
by: Justin Rich | last post by:
so im trying to be good and not leave anything hanging open but i guess ive seen a variety of ways to kill objects.. is there like a recommended way? basically im looking for best practices for handling object destruction. Thanks Justin
10
18915
EJaques
by: EJaques | last post by:
(Using Access 2003) I have a an Object OLE field in a table where users can insert Excel sheets, Word Docs, Pdfs etc. I need to create a button on a formulaire that allows the user to browse for, select and attach the file. The file must appear as an icon that can be double clicked on to be opened. The file should be stocked in the DB. I...
1
1994
by: HELENO | last post by:
Hi, I am designing a report for a world cup fantasy team competition that I have created in Access 97. Each entrant must pick 11 players, who can earn points, and i need the sum of all these points represented in a leader board report. I can create each individual's scores, but for some reason, the report won't sort itself by that field. I...
0
1467
by: Andrew Castro | last post by:
I have a program written in VB that loads an SWF object. The SWF object contains a field, in which I would like to load text to. The field is not focused when the SWF is loaded, either. I do not know if the SWF support flashvar. Does anyone have any idea how to do this?
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.