Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6410729
Votes 1
Synopsis Add BitSet.previousClearBit, previousSetBit
Category java:classes_util
Reported Against
Release Fixed 7(b20), 6-open(b01) (Bug ID:2152591)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs 6505531 , 6592006
Submit Date 10-APR-2006
Description
Josh Bloch writes,

"In 1.4, we added methods nextSetBit(int) and nextClearBit(int).  This was  customer  as far as it went.  We should also have added previousSetBit(int) and previousClearBit(int).  

The reason this is a reasonable RFE is that it's MUCH slower to code these methods up from the outside as you don't have access to the words that make up bit set, so you have to operate a bit at a time, range-checking the bit index each time.  The resulting method is probably 100 times as slow as it should be.  (I haven't timed it, so don't believe this estimate.)"
Posted Date : 2006-04-10 05:12:43.0
Work Around
N/A
Evaluation
A reasonable suggestion
Posted Date : 2006-04-10 05:12:43.0
Comments
  
  Include a link with my name & email   

Submitted On 23-DEC-2006
dmbdmb
Totally agree. almost word for word, infact.

bug_id=6505531


Submitted On 07-MAY-2007
pbwest
If the maximum size of the BitSet is known at instantiation, a workaround while we wait for 6410729 is to create a class with two BitSets, with one being the inverse of the other.  Define those set manipulation operations in which you are interested to update both BitSets. Then the previousSetBit and previousClearBit operations can be defined by means of nextSetBit and nextClearBit on the inverse BitSet.


Submitted On 07-MAY-2007
pbwest
Replace all occurrences of "inverse" in my previous post with "reverse". That is the bits in the 2nd set are maintained in reverse order of the 1st set.


Submitted On 10-JUN-2007
pbwest
I have posted an implementation of this on the jdk-collaboration dev forum at
https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=19753

No-one seems to be monitoring the forum, so maybe I've got the wrong idea about the way to contribute.



PLEASE NOTE: JDK6 is formerly known as Project Mustang