@Test public void equalsTest() { for (int tileSize : TILE_SIZES) { Tile tile1 = new Tile(1, 1, (byte) 1, tileSize); Tile tile2 = new Tile(2, 2, (byte) 2, tileSize); QueueItem<Job> queueItem1 = new QueueItem<Job>(new Job(tile1, false)); QueueItem<Job> queueItem2 = new QueueItem<Job>(new Job(tile1, false)); QueueItem<Job> queueItem3 = new QueueItem<Job>(new Job(tile2, false)); TestUtils.equalsTest(queueItem1, queueItem2); Assert.assertNotEquals(queueItem1, queueItem3); Assert.assertNotEquals(queueItem3, queueItem1); Assert.assertNotEquals(queueItem1, new Object()); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof QueueItem)) { return false; } QueueItem<?> other = (QueueItem<?>) obj; return this.object.equals(other.object); }
QueueItem { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof QueueItem)) { return false; } QueueItem<?> other = (QueueItem<?>) obj; return this.object.equals(other.object); } }
QueueItem { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof QueueItem)) { return false; } QueueItem<?> other = (QueueItem<?>) obj; return this.object.equals(other.object); } QueueItem(T object); }
QueueItem { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof QueueItem)) { return false; } QueueItem<?> other = (QueueItem<?>) obj; return this.object.equals(other.object); } QueueItem(T object); @Override boolean equals(Object obj); @Override int hashCode(); }
QueueItem { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof QueueItem)) { return false; } QueueItem<?> other = (QueueItem<?>) obj; return this.object.equals(other.object); } QueueItem(T object); @Override boolean equals(Object obj); @Override int hashCode();  }