tambre
tambre

Reputation: 4863

Converting boolean to BitSet in Java

So I before had this:

public static final boolean opaqueCubeLookup = new boolean[4096];

But I found out that BitSet it much better at managing memory, so I changed it to this:

public static final BitSet opaqueCubeLookup = new BitSet(4096);

I also had this code:

opaqueCubeLookup[par1] = this.isOpaqueCube();

But after moving to BitSet I have problem, I get this error:

The type of the expression must be an array type but it resolved to BitSet

How can I fix it? Any help is appreciated!

Upvotes: 0

Views: 1268

Answers (2)

Alexander Torstling
Alexander Torstling

Reputation: 18908

opaqueCudeLookup.set(par1, this.isOpaqueCube());

See BitSet.html#set(int, boolean)

Upvotes: 4

Eyal Schneider
Eyal Schneider

Reputation: 22456

Use:

opaqueCubeLookup.set(part1, this.isOpaqueCube());

Upvotes: 0

Related Questions