Q:

How to compare the textures in LibGdx

I am using LibGdx for my game. In the below method I am passing the RED_BALL but the method is not returning true. I want to know if the texture comparision is possible. if so what is the best approach.
private boolean isSqueezableBalls(Texture t) {
    if(t.equals(RED_BALL) || 
            t.equals(BLUE_BALL) || 
                t.equals(GREEN_BALL)){ 
        return true;
    }
    return false; 
}

A:

What you need to do is to develop a more OOP coding habbit.
Then you could add a texture to a class and when you need to compare it there will be no problems. You can later simply check the instance.
 class Ball {
        // Ball Data

        public Ball() {
            // ADD LOGIC
        }
    }

    class GreenBall extends Ball {

        public GreenBall() {
            super();
            // ADD LOGIC
        }
    }

    class RedBall extends Ball {

        public RedBall() {
            super();
            //ADD LOGIC
        }

So you could have a method like:
private void isSquizableBall(Ball b) {
    if(b instanceof GreenBall){ 
        System.out.print("It's a green ball");

    } else if(b instanceof RedBall){ 
        System.out.print("It's a green ball");
    }
}

