Couple and Triple minor cleanup.

This commit is contained in:
Olof Larsson 2016-08-24 09:12:34 +02:00
parent b847737de8
commit 51eee0e247
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474
2 changed files with 18 additions and 13 deletions

View File

@ -18,10 +18,10 @@ public class Couple<A, B> implements Entry<A, B>, Cloneable, Serializable
// -------------------------------------------- //
private final A first;
public A getFirst() { return this.first; };
public A getFirst() { return this.first; }
private final B second;
public B getSecond() { return this.second; };
public B getSecond() { return this.second; }
// -------------------------------------------- //
// FIELDS: WITH
@ -63,7 +63,7 @@ public class Couple<A, B> implements Entry<A, B>, Cloneable, Serializable
}
@Override
public B setValue(B arg0)
public B setValue(B value)
{
throw new IllegalStateException("This entry is a couple which is immutable.");
}
@ -82,12 +82,14 @@ public class Couple<A, B> implements Entry<A, B>, Cloneable, Serializable
// -------------------------------------------- //
@Override
public boolean equals(Object derpObject)
public boolean equals(Object object)
{
if (derpObject == null) return false;
if (!(derpObject instanceof Couple<?, ?>)) return false;
Couple<?, ?> derp = (Couple<?, ?>)derpObject;
return MUtil.equals(this.getFirst(), derp.getFirst()) && MUtil.equals(this.getSecond(), derp.getSecond());
if (!(object instanceof Couple<?, ?>)) return false;
Couple<?, ?> that = (Couple<?, ?>)object;
return MUtil.equals(
this.getFirst(), that.getFirst(),
this.getSecond(), that.getSecond()
);
}
// -------------------------------------------- //

View File

@ -63,12 +63,15 @@ public class Triple<A, B, C> implements Cloneable, Serializable
// -------------------------------------------- //
@Override
public boolean equals(Object derpObject)
public boolean equals(Object object)
{
if (derpObject == null) return false;
if (!(derpObject instanceof Triple<?, ?, ?>)) return false;
Triple<?, ?, ?> derp = (Triple<?, ?, ?>)derpObject;
return MUtil.equals(this.getFirst(), derp.getFirst()) && MUtil.equals(this.getSecond(), derp.getSecond()) && MUtil.equals(this.getThird(), derp.getThird());
if (!(object instanceof Triple<?, ?, ?>)) return false;
Triple<?, ?, ?> that = (Triple<?, ?, ?>)object;
return MUtil.equals(
this.getFirst(), that.getFirst(),
this.getSecond(), that.getSecond(),
this.getThird(), that.getThird()
);
}
// -------------------------------------------- //