I am using the Vector2 class of the libGDX API, and if I want to check the equality of two vectors I have to do the following:
Vector2 vectA = new Vector2(0, 1);
Vector2 vectB = new Vector2(1, 1);
if (vectA.x == vectB.x && vectA.y == vectB.y) {
return true;
}
This is very uncomfortable and I am thinking about creating an equals() method for this scenario. Which should be the better to do:
- Creating a wrapper for the Vector2 class with an equals(Vector2) method
- Creating an EqualUtil class with an equals(Vector2, Vector2) method
The first would look better (in my opinion), but it may not be a 'nice' solution while the other is much cleaner but also a bit simplistic. Different ideas also welcome.