Skip to content

Instantly share code, notes, and snippets.

@Nucleareal
Created November 6, 2013 15:43
Show Gist options
  • Save Nucleareal/7338272 to your computer and use it in GitHub Desktop.
Save Nucleareal/7338272 to your computer and use it in GitHub Desktop.
なるほどね
package net.minecraft.src.nucleareal;
import java.util.List;
public class UtilList
{
public static <T> int getLimitOrder(List<T> nextList, INumberCreator<T> order, int sign)
{
int now = order.getValue(nextList.get(0)) * sign;
for(T element : nextList)
{
int value = order.getValue(element) * sign;
if(value < now)
{
now = value;
}
}
return now;
}
public static <T> int getMinValue(List<T> nextList, INumberCreator<T> order)
{
return getLimitOrder(nextList, order, +1);
}
public static <T> int getMaxValue(List<T> nextList, INumberCreator<T> order)
{
return getLimitOrder(nextList, order, -1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment