?
Solved

documentation

Posted on 2003-03-06
1
Medium Priority
?
160 Views
Last Modified: 2010-03-31
Hi:
   Is my documentation for the following method correct?import java.util.Comparator;

/**
A class that implemements the Comparator interface for sorting objects.
@author Somebody
@version 1.0
*/
class FullNameComp implements Comparator

{

/**
A method that compares arguments for natural order.
@param obj1 The first object.
@param obj2  The second object.
@return     A negative integer, zero, or a positive integer as this
            object is less than, equal to, or greater than the
            specified object.
*/
public int compare(Object obj1, Object obj2)
{
   PhoneBook people1 = (PhoneBook) obj1;
   PhoneBook people2 = (PhoneBook) obj2;
   return people1.fullName.compareTo(people2.fullName);
}

}

0
Comment
Question by:LearningJava
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
TimYates earned 300 total points
ID: 8079617
Looks it :-)

I usually do:

/**
 * A class that implemements the Comparator interface for   sorting objects.
 * @author Somebody
 * @version 1.0
 */
class FullNameComp implements Comparator

{

/**
 * A method that compares arguments for natural order.
 * @param obj1 The first object.
 * @param obj2  The second object.
 * @return     A negative integer, zero, or a positive integer as this
 *             object is less than, equal to, or greater than the
 *             specified object.
 */
public int compare(Object obj1, Object obj2)
{
  PhoneBook people1 = (PhoneBook) obj1;
  PhoneBook people2 = (PhoneBook) obj2;
  return people1.fullName.compareTo(people2.fullName);
}

}

As it makes them stand out a bit more :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question