mirror of
https://bitbucket.org/Mattrixwv/javaclasses.git
synced 2025-12-06 15:03:58 -05:00
Fix sonarqube findings
This commit is contained in:
@@ -48,8 +48,7 @@ public class Triple<T, U, V>{
|
||||
if(this == o){
|
||||
return true;
|
||||
}
|
||||
else if(o instanceof Triple<?, ?, ?>){
|
||||
Triple<?, ?, ?> rightSide = (Triple<?, ?, ?>)o;
|
||||
else if(o instanceof Triple<?, ?, ?> rightSide){
|
||||
return (a.equals(rightSide.a) && b.equals(rightSide.b) && c.equals(rightSide.c));
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -51,7 +51,7 @@ public class HexagonalNumberGenerator implements Iterator<Long>{
|
||||
}
|
||||
|
||||
public static boolean isHexagonal(Long x){
|
||||
Long n = Math.round((Math.sqrt(1 + (8 * x)) + 1) / 4);
|
||||
Long n = Math.round((Math.sqrt(1.0 + (8 * x)) + 1) / 4);
|
||||
return ((2 * n * n) - n) == x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PentagonalNumberGenerator implements Iterator<Long>{
|
||||
}
|
||||
|
||||
public static boolean isPentagonal(Long x){
|
||||
Long n = Math.round((Math.sqrt(1 + (24 * x)) + 1) / 6);
|
||||
Long n = Math.round((Math.sqrt(1.0 + (24 * x)) + 1) / 6);
|
||||
return (((3 * n * n) - n) / 2) == x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TriangularNumberGenerator implements Iterator<Long>{
|
||||
}
|
||||
|
||||
public static boolean isTriangular(Long x){
|
||||
Long n = Math.round((Math.sqrt(1 + (8 * x)) - 1) / 2);
|
||||
Long n = Math.round((Math.sqrt(1.0 + (8 * x)) - 1) / 2);
|
||||
return (((n * n) + n) / 2) == x;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user