Skip to content

Instantly share code, notes, and snippets.

@gorrotowi
Created October 12, 2017 16:43
Show Gist options
  • Save gorrotowi/48043d8206f38454c1f602095953282a to your computer and use it in GitHub Desktop.
Save gorrotowi/48043d8206f38454c1f602095953282a to your computer and use it in GitHub Desktop.
Platzi POJO Java vs Kotlin
data class Galleta(val sabor: String, val chispas: String)
public class GalletaJv {
private String sabor;
private String chispas;
public GalletaJv(String sabor, String chispas) {
this.sabor = sabor;
this.chispas = chispas;
}
public String getSabor() {
return sabor;
}
public void setSabor(String sabor) {
this.sabor = sabor;
}
public String getChispas() {
return chispas;
}
public void setChispas(String chispas) {
this.chispas = chispas;
}
@Override
public String toString() {
return "GalletaJv{" +
"sabor='" + sabor + '\'' +
", chispas='" + chispas + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GalletaJv galletaJv = (GalletaJv) o;
if (sabor != null ? !sabor.equals(galletaJv.sabor) : galletaJv.sabor != null) return false;
return chispas != null ? chispas.equals(galletaJv.chispas) : galletaJv.chispas == null;
}
@Override
public int hashCode() {
int result = sabor != null ? sabor.hashCode() : 0;
result = 31 * result + (chispas != null ? chispas.hashCode() : 0);
return result;
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
protected void finalize() throws Throwable {
super.finalize();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment