[New] Added .hashCode() and .equals() to MapOf*

This commit is contained in:
Robert von Burg 2020-02-14 16:25:31 +01:00
parent ffc62e7351
commit bbbe75b2b0
3 changed files with 51 additions and 0 deletions

View File

@ -160,4 +160,21 @@ public class MapOfLists<T, U> {
action.accept(k, u);
}
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MapOfLists<?, ?> that = (MapOfLists<?, ?>) o;
return Objects.equals(this.mapOfLists, that.mapOfLists);
}
@Override
public int hashCode() {
return this.mapOfLists != null ? this.mapOfLists.hashCode() : 0;
}
}

View File

@ -205,4 +205,21 @@ public class MapOfMaps<T, U, V> {
action.accept(k, u);
}
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MapOfMaps<?, ?, ?> mapOfMaps1 = (MapOfMaps<?, ?, ?>) o;
return Objects.equals(this.mapOfMaps, mapOfMaps1.mapOfMaps);
}
@Override
public int hashCode() {
return this.mapOfMaps != null ? this.mapOfMaps.hashCode() : 0;
}
}

View File

@ -160,4 +160,21 @@ public class MapOfSets<T, U> {
action.accept(k, u);
}
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MapOfSets<?, ?> mapOfSets1 = (MapOfSets<?, ?>) o;
return Objects.equals(this.mapOfSets, mapOfSets1.mapOfSets);
}
@Override
public int hashCode() {
return this.mapOfSets != null ? this.mapOfSets.hashCode() : 0;
}
}