@Test public void testHashCode() throws Exception { DataSet ds2 = new DataSet(MovieRentalView.getDateFormatter()); assertEquals(ds.hashCode(), ds2.hashCode()); List<Movie> ml = ds2.getMovieList(); ml.clear(); ml.add(new Movie("Bla", RegularPriceCategory.getInstance())); assertTrue(ds.hashCode() != ds2.hashCode()); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((rentalList == null) ? 0 : rentalList.hashCode()); result = prime * result + ((userList == null) ? 0 : userList.hashCode()); return result; }
DataSet { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((rentalList == null) ? 0 : rentalList.hashCode()); result = prime * result + ((userList == null) ? 0 : userList.hashCode()); return result; } }
DataSet { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((rentalList == null) ? 0 : rentalList.hashCode()); result = prime * result + ((userList == null) ? 0 : userList.hashCode()); return result; } DataSet(DateFormat dateFormat); }
DataSet { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((rentalList == null) ? 0 : rentalList.hashCode()); result = prime * result + ((userList == null) ? 0 : userList.hashCode()); return result; } DataSet(DateFormat dateFormat); List<IUser> getUserList(); IUser getUserById(int id); IUser getUserByName(String name); void updateRentalsWithUser(User user); Object[][] getUserListAsObject(); List<Movie> getMovieList(); Object[][] getMovieListAsObject(boolean rented, boolean available); Movie getMovieById(long id); void updateMovie(Movie movie); Object[][] getMovieListAsObject(); List<Rental> getRentalList(); Object[][] getRentalListAsObject(); @Override int hashCode(); @Override boolean equals(Object obj); }
DataSet { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((rentalList == null) ? 0 : rentalList.hashCode()); result = prime * result + ((userList == null) ? 0 : userList.hashCode()); return result; } DataSet(DateFormat dateFormat); List<IUser> getUserList(); IUser getUserById(int id); IUser getUserByName(String name); void updateRentalsWithUser(User user); Object[][] getUserListAsObject(); List<Movie> getMovieList(); Object[][] getMovieListAsObject(boolean rented, boolean available); Movie getMovieById(long id); void updateMovie(Movie movie); Object[][] getMovieListAsObject(); List<Rental> getRentalList(); Object[][] getRentalListAsObject(); @Override int hashCode(); @Override boolean equals(Object obj);  }