AFAICT, the class libraries running on Android (as opposed to the ones you link against on your computer) come from Apache Harmony.


I'm a bit confused by the OP. I thought it was in reference to Andorid's java.util.HashSet. However it seems to be in reference to the Apache Harmony project.

I suppose the OP's problem is in porting code that was using Harmony to Android?

On Mon, Jan 11, 2010 at 3:32 PM, Philip <<mailto:[email protected]>[email protected]> wrote:

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 <<mailto:[email protected]>[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://commonsware.com|<http://twitter.com/commonsguy>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 <mailto:[email protected]>[email protected]
To unsubscribe from this group, send email to
<mailto:android-developers%[email protected]>[email protected]
For more options, visit this group at
<http://groups.google.com/group/android-developers?hl=en>http://groups.google.com/group/android-developers?hl=en



--
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


--
jason.vp.engineering.particle
-- 
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