Java ArrayList<GenericObject>.remove(GenericObject) returns false, but still decrements size of ArrayList

Quite a simple problem, but clouded by all your code:

if (! heds.faces.remove(currentHE.twin.leftFace));

It's the semicolon at the end of the if-condition. That semicolon ends the statement, which is your if statement. It turns the "then" part of your if block into an empty statement (so nothing happens). Then you have a floating block after it that always happens.

Your code executes like this:

if (! heds.faces.remove(currentHE.twin.leftFace))
    ; //this empty statement never gets executed, but nothing to execute anyhow

    //this will always print (since it's not guarded by the if)
    System.out.println("We have a twin problem");

In other words, heds.faces.remove() is indeed returning true; you just failed to report the result correctly. Remove the semi-colon and the output should start to make sense to you.


I'm trying to write custom JFrame and JPanel for my Java application. Currently, I just want to have a JPanel with a start button in the very middle of the screen. So, here's the code I have: package ...

We're thinking of using Protocol Buffers for binary logging because: It's how we're encoding our objects anyway It is relatively compact, fast to read / write etc. That said, it isn't obvious how we ...

I am running Gnome on OpenSuse. As a result, my system look and feel is GTK+, which has numerous ugly problems (see some of them here). During development of my swing app, I can run the client from ...

Pesquisei muitos sites sobre como fazer isso usando apenas a chave da planilha, mas sem sucesso. Posso recuperá-lo, obter todos os dados que desejar, mas não consigo anexar uma nova linha a ele. Eu já ...