I have an ArrayList of the Class `ZombieSprite` in my `GameView` class which includes all my `ZombieSprites`. In my `ZombieSprite` class i have the method `getDirection()`. Now i dont want the `ZombieSprites` to collide. So need to check if the variable `x` of the object `thezombiesprite` id the `ArrayList` is equal to any other variable `x` of an object `thezombiesprite` in the `ArrayList`.

```
public class GameView extends SurfaceView {
  // not interesting 
  List<ZombieSprite> zombieSpriteList = new ArrayList<ZombieSprite>();
  // not interesting

public class ZombieSprite {
    private int x = 0;
private int y = 0;
  private void getDirection() {
    if (x < PlayerSprite.x) {
        x = x + xSpeed;
    }
    if (x > PlayerSprite.x) {
        x = x - xSpeed;
    }
    if (x == PlayerSprite.x) {
        x = x;
    }
    if (y < PlayerSprite.y) {
        y = y + ySpeed + backgroundspeed;
    }
    if (y > PlayerSprite.y) {
        y = y - ySpeed + backgroundspeed;
    }
    if (y == PlayerSprite.y) {
        y = y + backgroundspeed;
    }

}

```

I tried it with including following code into the getDireciton() method and added the ArrayList zombieSpriteList into the ZombieSprite class, too.

```
            theGameView.getZombieSpriteList();
    theGameView.zombieSpriteList = zombieSpriteList;
    for (ZombieSprite thezombiesprite : zombieSpriteList) {

    }

```