Last active
February 15, 2017 08:47
-
-
Save sujeet100/6476dc6184e9c7bbf1c8edde9baf3db5 to your computer and use it in GitHub Desktop.
Collections in Scala, Groovy and Java 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Book { | |
private String name; | |
private String author; | |
private int numberOfPages; | |
public Book(String name, String author, int numberOfPages) { | |
this.name = name; | |
this.author = author; | |
this.numberOfPages = numberOfPages; | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public String getAuthor() { | |
return author; | |
} | |
public void setAuthor(String author) { | |
this.author = author; | |
} | |
public int getNumberOfPages() { | |
return numberOfPages; | |
} | |
public void setNumberOfPages(int numberOfPages) { | |
this.numberOfPages = numberOfPages; | |
} | |
@Override | |
public boolean equals(Object o) { | |
return name.equals(((Book) o).name); | |
} | |
@Override | |
public int hashCode() { | |
return name.hashCode(); | |
} | |
@Override | |
public String toString() { | |
return this.name + " : " + this.author + " : " + this.numberOfPages; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment