Why You Should Learn Scala in 2021?

Photo by NESA by Makers on Unsplash
Photo by Émile Perron on Unsplash
package gsmav4.es12;

import java.util.Objects;

public class Product {
private String name;
private double price;

public Product(final String name, final double price) {
this.name = name;
this.price = price;
}

@Override
public int hashCode() {
int hash = 7;
hash = 23 * hash + Objects.hashCode(this.name) + Objects.hashCode(this.price);
return hash;
}

@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Product other = (Product) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
if (Double.doubleToLongBits(this.price) != Double.doubleToLongBits(other.price)) {
return false;
}
return true;
}

@Override
public String toString() {
return "Product{" + "name=" + name + ", price=" + price + '}';
}
}
case class Product(name: String, price: double)
Photo by Austin Distel on Unsplash

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store