public class Ordering extends Object
Constructor and Description |
---|
Ordering() |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
firstOf(List<T> list,
int count,
Sort... sorts)
From the sorts, this is the first few items.
|
static <T> T |
firstOf(List<T> list,
Sort... sorts)
First of... out of hte sorts.
|
static <T> List<T> |
greatest(List<T> list,
int count)
Returns the greatest.
|
static <T> List<T> |
greatest(List<T> list,
String sortBy,
int count)
Returns the greatest few.
|
static <T> List<T> |
lastOf(List<T> list,
int count,
Sort... sorts)
Grabs the last few items from the list.
|
static <T> T |
lastOf(List<T> list,
Sort... sorts)
Grabs the last items after the sort.
|
static <T> List<T> |
least(List<T> list,
int count)
Returns the least few.
|
static <T> List<T> |
least(List<T> list,
String sortBy,
int count)
Returns the least few.
|
static <T> T |
max(List<T> list)
Gets the max item from the list.
|
static <T> T |
max(List<T> list,
String sortBy)
Returns the max value of the object with the property given.
|
static <T> T |
max(T[] array)
Gets the max item from the array.
|
static <T> T |
max(T[] array,
String sortBy)
Returns the max value of the object with the property given.
|
static <T> T |
min(List<T> list)
Returns the min value using a natural sort.
|
static <T> T |
min(List<T> list,
String sortBy)
Returns the min value after sorting by the sortBy parameter.
|
static <T> T |
min(T[] array)
Returns the max value of the object with the property given.
|
static <T> T |
min(T[] array,
String sortBy)
Returns the min value of the object with the property given.
|
static <T> T |
search(List<T> list,
T item)
Does a binary search
NOTE THIS WILL NOT SORT THE LIST ASCENDING.
|
static int |
searchForIndex(List<?> list,
Object item)
Does a binary search
NOTE THIS WILL NOT SORT THE LIST ASCENDING.
|
public static <T> T search(List<T> list, T item)
T
- type of itemlist
- items you want to search.item
- the item you are searching for.public static int searchForIndex(List<?> list, Object item)
list
- list you are searchingitem
- the item you are searching forpublic static <T> T max(List<T> list)
T
- type of itemslist
- the listpublic static <T> T max(T[] array)
T
- type of itemsarray
- the listpublic static <T> T firstOf(List<T> list, Sort... sorts)
T
- list
- sorts
- public static <T> List<T> firstOf(List<T> list, int count, Sort... sorts)
T
- list
- count
- sorts
- public static <T> T lastOf(List<T> list, Sort... sorts)
T
- list
- sorts
- public static <T> List<T> lastOf(List<T> list, int count, Sort... sorts)
T
- list
- count
- sorts
- public static <T> T max(List<T> list, String sortBy)
T
- list
- sortBy
- public static <T> T max(T[] array, String sortBy)
T
- array
- sortBy
- public static <T> List<T> least(List<T> list, int count)
T
- list
- count
- public static <T> List<T> least(List<T> list, String sortBy, int count)
T
- list
- sortBy
- count
- public static <T> List<T> greatest(List<T> list, int count)
T
- list
- count
- public static <T> List<T> greatest(List<T> list, String sortBy, int count)
T
- list
- sortBy
- count
- public static <T> T min(List<T> list)
T
- list
- public static <T> T min(T[] array)
T
- array
- public static <T> T min(List<T> list, String sortBy)
T
- list
- sortBy
- public static <T> T min(T[] array, String sortBy)
T
- array
- sortBy
- Copyright © 2014. All rights reserved.