-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
472 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.github.ititus.data.pair; | ||
|
||
import io.github.ititus.data.ArrayUtil; | ||
|
||
public final class IntIntPair { | ||
|
||
private final int a; | ||
private final int b; | ||
|
||
private IntIntPair(int a, int b) { | ||
this.a = a; | ||
this.b = b; | ||
} | ||
|
||
public int a() { | ||
return a; | ||
} | ||
|
||
public int b() { | ||
return b; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof IntIntPair)) { | ||
return false; | ||
} | ||
IntIntPair that = (IntIntPair) o; | ||
return a == that.a && b == that.b; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return ArrayUtil.hash(a, b); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "<" + a + "," + b + ">"; | ||
} | ||
|
||
public static IntIntPair of(int a, int b) { | ||
return new IntIntPair(a, b); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/github/ititus/data/pair/LongLongPair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.github.ititus.data.pair; | ||
|
||
import io.github.ititus.data.ArrayUtil; | ||
|
||
public final class LongLongPair { | ||
|
||
private final long a; | ||
private final long b; | ||
|
||
private LongLongPair(long a, long b) { | ||
this.a = a; | ||
this.b = b; | ||
} | ||
|
||
public long a() { | ||
return a; | ||
} | ||
|
||
public long b() { | ||
return b; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof LongLongPair)) { | ||
return false; | ||
} | ||
LongLongPair that = (LongLongPair) o; | ||
return a == that.a && b == that.b; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return ArrayUtil.hash(a, b); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "<" + a + "," + b + ">"; | ||
} | ||
|
||
public static LongLongPair of(long a, long b) { | ||
return new LongLongPair(a, b); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.