Hi,
No idea about the first issue, waiting for solution.

For second issue, we can do it by following way.

        TreeSet set = new TreeSet(new Comparator() {
            public int compare(Object o1, Object o2) {
                return o1.toString().compareTo(o2.toString());
            }
        });

Then we can put all kinds of object.

Zjibo
---------------------------------------------------------------------------------------------
On Wed, Sep 30, 2009 at 12:20 AM, Eudis René Duarte Sanguino <
[email protected]> wrote:

>
> the exercise says:
>
>    - Create your own NetBeans project named as MyTreeSet
>    - Create your own TreeSet object with initial capacity of 5 *//don't
>    exist a constructor with this parameter*
>    - Add the following objects to the newly created TreeSet object
>     - 2 String objects
>       - 2 MyOwnClass object (You will have to create MyOwnClass.java
>       first)*//how I create this class?, I have implemented Comparable
>       interfaz, but I am not sure*
>       - 3 Integer ojbects
>    - Create Iterator object from the TreeSet object and iterate them to
>    get displayed
>
>
> *this is MyOwnClass:*
>
> package mytreeset;
>
> import java.lang.Comparable;
>
> public class MyOwnClass implements Comparable<MyOwnClass> {
>
>     public int compareTo(MyOwnClass o){
>         return 0;
>
>     }
> }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to