public class ListUtility extends Object
Constructor | Description |
---|---|
ListUtility() |
Modifier and Type | Method | Description |
---|---|---|
static <T> T[] |
array(Iterable<T> itbl,
T[] array) |
|
static <T> List<T> |
concat(Collection<? extends T>... lists) |
Concatenates a number of Collections into a single List
|
static boolean |
contains(String[] haystack,
String needle) |
|
static <T> boolean |
contains(Collection<T> c,
T o) |
|
static <T> boolean |
empty(Collection<T> c) |
|
static boolean |
empty(Map<?,?> m) |
|
static char[] |
flip(char[] src,
char[] dest,
int start,
int length) |
Reverses a character array
|
static int[] |
flip(int[] src,
int[] dest,
int start,
int length) |
Reverses an integer array
|
static <T> List<T> |
flip(List<T> src) |
Reverses a list
|
static <T> List<T> |
flip(List<T> src,
List<T> dest,
int start,
int length) |
Reverses a list
|
static <T> T[] |
flip(T[] src) |
Reverses an array
|
static <T> T[] |
flip(T[] src,
T[] dest,
int start,
int length) |
Reverses an array
|
static <T> T |
head(List<T> list) |
Returns the first element of a list (or null if the list is empty)
|
static <T> HybridIterator<T> |
iterate(Enumeration<T> items) |
|
static <T> HybridIterator<T> |
iterate(Iterator<T> items) |
|
static <T> List<T> |
join(Iterable<T>... items) |
|
static <T> List<T> |
last(List<T> src,
int count) |
Return, at most, the last n items from the source list
|
static <T> int |
length(Collection<T> items) |
|
static <T> int |
length(T[] items) |
|
static <T> List<T> |
list(Iterable<T> iterable) |
Converts an Iterable into a List
|
static <T> List<T> |
list(List<T> items) |
|
static <T> List<T> |
list(T[] items) |
|
static <T> int |
size(Collection<T> items) |
|
static <T> int |
size(T[] items) |
|
static <T> List<T> |
tail(List<T> list) |
Returns a sublist containing all the items in the list after the first
|
static <T> Set<T> |
union(Collection<? extends T>... lists) |
Concatenates a number of Collections into a single Set
|
public static <T> List<T> list(T[] items)
public static <T> List<T> list(Iterable<T> iterable)
iterable
- public static <T> T[] array(Iterable<T> itbl, T[] array)
public static <T> List<T> last(List<T> src, int count)
T
- the list typesrc
- the source listcount
- the maximum number of itemspublic static <T> T head(List<T> list)
list
- public static <T> List<T> tail(List<T> list)
list
- public static <T> T[] flip(T[] src, T[] dest, int start, int length)
T
- src
- dest
- start
- length
- public static <T> T[] flip(T[] src)
T
- src
- public static <T> List<T> flip(List<T> src, List<T> dest, int start, int length)
T
- src
- dest
- start
- length
- public static <T> List<T> flip(List<T> src)
T
- src
- public static int[] flip(int[] src, int[] dest, int start, int length)
src
- dest
- start
- length
- public static char[] flip(char[] src, char[] dest, int start, int length)
src
- dest
- start
- length
- public static <T> HybridIterator<T> iterate(Iterator<T> items)
public static <T> HybridIterator<T> iterate(Enumeration<T> items)
public static <T> int size(T[] items)
public static <T> int size(Collection<T> items)
public static <T> int length(T[] items)
public static <T> int length(Collection<T> items)
public static boolean empty(Map<?,?> m)
public static <T> boolean empty(Collection<T> c)
public static <T> boolean contains(Collection<T> c, T o)
public static <T> List<T> concat(Collection<? extends T>... lists)
T
- lists
- public static <T> Set<T> union(Collection<? extends T>... lists)
T
- lists
- Copyright © 2018. All rights reserved.