Skip to content

Commit

Permalink
Extract size variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Donald Raab authored and Donald Raab committed Feb 19, 2016
1 parent a4b331f commit 0e5cf41
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,8 @@ public static <T> float injectInto(float injectValue, List<T> list, FloatObjectT
public static <T> long sumOfInt(List<T> list, IntFunction<? super T> function)
{
long result = 0;
for (int i = 0; i < list.size(); i++)
int size = list.size();
for (int i = 0; i < size; i++)
{
result += (long) function.intValueOf(list.get(i));
}
Expand All @@ -784,7 +785,8 @@ public static <T> long sumOfInt(List<T> list, IntFunction<? super T> function)
public static <T> long sumOfLong(List<T> list, LongFunction<? super T> function)
{
long result = 0L;
for (int i = 0; i < list.size(); i++)
int size = list.size();
for (int i = 0; i < size; i++)
{
result += function.longValueOf(list.get(i));
}
Expand All @@ -795,7 +797,8 @@ public static <T> double sumOfFloat(List<T> list, FloatFunction<? super T> funct
{
double sum = 0.0d;
double compensation = 0.0d;
for (int i = 0; i < list.size(); i++)
int size = list.size();
for (int i = 0; i < size; i++)
{
double adjustedValue = (double) function.floatValueOf(list.get(i)) - compensation;
double nextSum = sum + adjustedValue;
Expand All @@ -809,7 +812,8 @@ public static <T> double sumOfDouble(List<T> list, DoubleFunction<? super T> fun
{
double sum = 0.0d;
double compensation = 0.0d;
for (int i = 0; i < list.size(); i++)
int size = list.size();
for (int i = 0; i < size; i++)
{
double adjustedValue = function.doubleValueOf(list.get(i)) - compensation;
double nextSum = sum + adjustedValue;
Expand Down

0 comments on commit 0e5cf41

Please sign in to comment.