Skip to content

Commit

Permalink
Move to inner classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Oct 31, 2021
1 parent 74a5400 commit 34f3fd8
Showing 1 changed file with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@

import java.util.Comparator;

interface IntegerPair {
public Integer getKey();
public Integer getValue();
}

class GrailPair implements IntegerPair {
private Integer key;
private Integer value;

public GrailPair(Integer key, Integer value) {
this.key = key;
this.value = value;
}
@Override
public Integer getKey() {
return this.key;
public class Tester {
interface IntegerPair {
public Integer getKey();
public Integer getValue();
}
@Override
public Integer getValue() {
return this.value;

class GrailPair implements IntegerPair {
private Integer key;
private Integer value;

public GrailPair(Integer key, Integer value) {
this.key = key;
this.value = value;
}
@Override
public Integer getKey() {
return this.key;
}
@Override
public Integer getValue() {
return this.value;
}
}
}

class GrailComparator implements Comparator<GrailPair> {
@Override
public int compare(GrailPair o1, GrailPair o2) {
if (o1.getKey() < o2.getKey()) return -1;
else if(o1.getKey() > o2.getKey()) return 1;
else return 0;
class GrailComparator implements Comparator<GrailPair> {
@Override
public int compare(GrailPair o1, GrailPair o2) {
if (o1.getKey() < o2.getKey()) return -1;
else if(o1.getKey() > o2.getKey()) return 1;
else return 0;
}
}
}

public class Tester {
public Tester() {
new HolyGrailSort<GrailPair>(new GrailComparator());
}
Expand Down

0 comments on commit 34f3fd8

Please sign in to comment.