java - BitSet value at a given index value -


if have bitset in java has values {2,5,9,10,11}. how value @ index 2? or value @ given index.

i tried using get() function returns boolean value whether bit set or not.

so how can value @ given index can in arrays , arraylists in java.?

so how can value @ given index can in arrays , array lists in java.?

you can't ... in sense seem mean ... without breaking bitset abstraction.

a bitset conceptually flexible array of bits or true / false values. far api concerned, "value @ given index" (as describe it) either bit set (get(i) returns true) or unset (get(i) returns true).

you may being confused output produced bitset::tostring, displaying indexes in bitset bit set.

under hood bitset (typically) represented long[] cannot @ array via bitset api methods. (you could use nasty reflection break open abstraction, bad idea. if need able see backing array, better of implementing own api either "leaky abstraction" or methods specific application's needs. or bitwise operations on long[] directly.)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -