Witam jest taki kod;
package data;
public class Publication {
private int year;
private String title;
private String publisher;
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
protected Publication(int year, String title, String publisher) {
setYear(year);
setTitle(title);
setPublisher(publisher);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((publisher == null) ? 0 : publisher.hashCode());
result = prime * result + ((title == null) ? 0 : title.hashCode());
result = prime * result + year;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Publication other = (Publication) obj;
if (publisher == null) {
if (other.publisher != null)
return false;
} else if (!publisher.equals(other.publisher))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
** if (year != other.year)**
return false;
return true;
}
}
W ** zaznaczyłem fragment w którym występuje coś w rodzaju obiektu other, lecz nigdzie nie ma definiowanego takiego obiektu. Czy w javie istnieje coś takiego?