Thanks for your reply. Complaint is a strong word... I am merely
pointing it out ;-)

contains() works only to find out if the element is in the set or not
(it returns a bool.)
find would give me an iterator that I can use to get to the object
directly.

workaround that's using contains() to speed up the discovery of the
element in the set for now:

    public int numberOfNodes(Target target) {
        if (targets.contains(target)) {
            for (HashElement element: targets) {
             if (element.target == target)
                    return element.nodes != null ? element.nodes.size
() : 0;
            }
        } else
           return 0;
    }

Knowing that targets can only have unique targets, and because I am
reluctant to modify drastically from one platform to another, I am
using a HashSet with the current limitation I discovered in the
Android impl.

Thanks,

Philip

On Jan 11, 3:15 pm, Mark Murphy <[email protected]> wrote:
> Mark Murphy wrote:
> > Philip wrote:
> >> Any idea why such a fundamental method is missing from the dalvik
> >> libcore implementation?
>
> > HashSet is not a method. It is a class, and it exists in java.util.HashSet.
>
> Mea culpa. I misunderstood your complaint.
>
> What is wrong with contains()?
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 1.1 Available!
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
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/android-developers?hl=en

Reply via email to