Skip to content

Commit

Permalink
Add custom hash codes for CSV classes
Browse files Browse the repository at this point in the history
  • Loading branch information
physikerwelt committed Nov 21, 2021
1 parent 1e8c48c commit 0d0f32f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.opencsv.bean.CsvBindAndSplitByName;

import java.util.Objects;
import java.util.SortedSet;

@SuppressWarnings({"unused", "MismatchedQueryAndUpdateOfCollection"})
Expand All @@ -22,6 +23,11 @@ public boolean equals(Object obj) {

}

@Override
public int hashCode() {
return Objects.hash(determinant, dependant);
}

@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder("{");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.opencsv.bean.CsvBindAndSplitByName;
import com.opencsv.bean.CsvBindByName;

import java.util.Objects;
import java.util.SortedSet;

@SuppressWarnings("unused")
Expand All @@ -24,6 +25,10 @@ public enum Fields {
@CsvBindAndSplitByName(elementType = Fields.class, converter = LowerConverter.class, required = true)
private SortedSet<Fields> columns;

@Override
public int hashCode() {
return Objects.hash(table, candidateKey, columns);
}

@Override
public boolean equals(Object obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.opencsv.bean.CsvBindAndSplitByPosition;

import java.util.Objects;
import java.util.SortedSet;

public class KeySet {
Expand All @@ -18,4 +19,9 @@ public boolean equals(Object obj) {
}

}

@Override
public int hashCode() {
return Objects.hash(elements);
}
}

0 comments on commit 0d0f32f

Please sign in to comment.