Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2293
| Received | by 10.66.81.98 with SMTP id z2mr4627036pax.19.1354223526299; Thu, 29 Nov 2012 13:12:06 -0800 (PST) |
|---|---|
| Received | by 10.50.5.174 with SMTP id t14mr9735522igt.11.1354223526239; Thu, 29 Nov 2012 13:12:06 -0800 (PST) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.kjsl.com!usenet.stanford.edu!kt20no6158225pbb.1!news-out.google.com!6ni18488pbd.1!nntp.google.com!kr7no5852500pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.java.help |
| Date | Thu, 29 Nov 2012 13:12:06 -0800 (PST) |
| In-Reply-To | <k98i3b$bgi$1@dont-email.me> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T |
| NNTP-Posting-Host | 69.28.149.29 |
| References | <9b70426c-e378-4852-bc77-fc67440a93ef@googlegroups.com> <k98i3b$bgi$1@dont-email.me> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <aa3c6fd2-9566-400d-8df2-3525550f2cd9@googlegroups.com> (permalink) |
| Subject | Re: How to implement jcombobox with name value pair from database? |
| From | Lew <lewbloch@gmail.com> |
| Injection-Date | Thu, 29 Nov 2012 21:12:06 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.java.help:2293 |
Show key headers only | View raw
Knute Johnson wrote:
> public class Employee implements Comparable {
> private int number;
> private String name;
>
> public Employee(int number, String name) {
> this.number = number;
> this.name = name;
> }
>
> public String getName() {
> return name;
> }
>
> public int getNumber() {
> return number;
> }
>
> public int compareTo(Object emp) {
> return getName().compareTo(((Employee)emp).getName());
> }
>
> public String toString() {
> return String.format("%s %d",getName(),getNumber());
> }
> }
'Employee' needs to override 'equals()' to be consistent with 'compareTo()'.
--
Lew
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to implement jcombobox with name value pair from database? rogerdoger777 <kedward777@gmail.com> - 2012-11-29 09:14 -0800
Re: How to implement jcombobox with name value pair from database? kedward777@gmail.com - 2012-11-29 11:21 -0800
Re: How to implement jcombobox with name value pair from database? Roedy Green <see_website@mindprod.com.invalid> - 2012-12-04 18:08 -0800
Re: How to implement jcombobox with name value pair from database? Knute Johnson <nospam@knutejohnson.com> - 2012-11-29 12:55 -0800
Re: How to implement jcombobox with name value pair from database? Lew <lewbloch@gmail.com> - 2012-11-29 13:12 -0800
Re: How to implement jcombobox with name value pair from database? Knute Johnson <nospam@knutejohnson.com> - 2012-11-29 15:05 -0800
Re: How to implement jcombobox with name value pair from database? Lew <lewbloch@gmail.com> - 2012-11-29 16:08 -0800
Re: How to implement jcombobox with name value pair from database? kedward777@gmail.com - 2012-11-29 13:17 -0800
csiph-web