|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.core.ListUtil
public abstract class ListUtil
List Utilities. These are helper functions for dealing with lists.
Nested Class Summary | |
---|---|
static class |
ListUtil.Comparator<T extends java.util.List<?>>
Is a java.util.Comparator for Lists based on
a supplied elementComparator that delegates to
compare(java.util.List, java.util.List, java.util.Comparator) when doing the comparison. |
Field Summary | |
---|---|
static java.util.List |
ImmutableEmptyList
Deprecated. use Collections.emptyList() instead |
static java.lang.Class |
ImmutableListClass
|
Constructor Summary | |
---|---|
ListUtil()
|
Method Summary | ||
---|---|---|
static
|
addAll(java.util.Collection<? super T> collection,
java.lang.Iterable<T> toAdd)
Simple convenience method that adds the array elements in toAdd
to the collection . |
|
static
|
addElementIfAbsent(java.util.List<T> l,
T element)
Adds element as the last element of the List, if not already present within the List. |
|
static
|
addElementsIfAbsent(java.util.List<T> destList,
java.util.Collection<? extends T> aColl)
Adds the elements contained in aList that are not already present in the List to the end of the List. |
|
static
|
addToCollection(java.util.Collection<? super T> collection,
T[] toAdd)
Simple convenience method that adds the array elements in toAdd
to the collection . |
|
static void |
appendAndRemoveIfPresent(java.util.List destList,
java.util.Collection aColl)
Adds the elements contained in aList; delete the old element if existed |
|
static void |
appendAndRemoveIfPresent(java.util.List l,
java.lang.Object element)
Adds element as the last element of the List; delete the old element if existed . |
|
static
|
arrayToList(T[] array)
Creates a List from the objects in the given array. |
|
static
|
arrayToList(T[] array,
boolean copy)
Creates a List from the objects in the given array. |
|
static
|
cloneList(java.util.List<? extends T> l)
Helper method to clone a List. |
|
static
|
collectionToList(java.util.Collection<T> source)
Creates a new List with the same contents as the given Collection. |
|
static int |
compare(java.util.List first,
java.util.List second,
java.util.Comparator elementComparator)
Compares the elements of first and second
and returns a negative, zero or positive integer as first is
less than, equal to or greater than second , respectively. |
|
static
|
concatenate(java.util.List<T>... lists)
|
|
static
|
containsIdentical(java.util.List<T> l,
T element)
Checks if the list contains the element element using the == operator. |
|
static java.util.List |
copyAndSortMapInList(java.util.List list)
This method will do 2 things: 1) Copy objects which are not of type Map into a new List object. |
|
static int |
copyInto(java.util.List from,
java.util.List to,
int fromIndex,
int length)
Copies length elements of the list from to the list
to starting at the specified fromIndex . |
|
static void |
copyInto(java.util.List l,
java.lang.Object[] anArray,
int startingAt)
Copies the List's elements into anArray at a specified offset. |
|
static java.util.List |
copyList(java.util.List source)
Copy a Collection. |
|
static ListUtil.Comparator |
createComparator(java.util.Comparator elementComparator)
Returns a new instance of ListUtil.Comparator with the
specified elementComparator . |
|
static java.util.List<java.lang.String> |
delimitedStringToList(java.lang.String str,
char delimiter)
Tokenize a String with a specified separator character and return a list with the tokenized elements. |
|
static java.util.List |
diff(java.util.List change,
java.util.List baseline)
|
|
static java.util.List |
equalElements(java.util.List l1,
java.util.List l2)
Determine all elements common between two Lists. |
|
static
|
firstElement(java.util.List<T> l)
Returns the List's first element without modification of the List. |
|
static void |
fromSerializedString(java.util.List l,
java.lang.String serialized)
Populates the list with serialized data from the string. |
|
static java.util.List[] |
getChunkedLists(java.util.List list,
int maxChunkSize)
|
|
static int |
getListSize(java.util.List<?> list)
Null safe method to check the length of a List. |
|
static
|
hasSameElements(java.util.List<T> l1,
java.util.List<T> l2)
Returns true if the 2 input lists has the same size and contain the same elements, even though the elements may be stored at possibly a different order in the 2 lists. |
|
static
|
immutableList(java.util.List<? extends T> l)
Returns a version of the list that is not modifiable If l is null, null will be returned. |
|
static
|
indexOfIdentical(java.util.List<T> l,
T element)
Finds the location of an element in the List using the == operator for comparison. |
|
static
|
insertElementAfter(java.util.List<T> l,
T element,
T existingElement)
Inserts element after existingElement in the List. |
|
static
|
insertElementBefore(java.util.List<T> l,
T element,
T existingElement)
Inserts element before existingElement in the List. |
|
static
|
isSubList(java.util.List<T> subList,
java.util.List<T> l)
Returns true if list subList is the subList of
list l . |
|
static
|
lastElement(java.util.List<T> l)
Returns the List's last element without modification of the List. |
|
static
|
lastIndexOfIdentical(java.util.List<T> l,
T element)
Finds the last location of an element in the List using the == operator for comparison. |
|
static
|
lastIndexOfIdentical(java.util.List<T> l,
T element,
int startingAt)
Finds the last location of an element in the List using the == operator for comparison. |
|
static
|
list()
Constructs a new type-safe List with a small initial capacity. |
|
static
|
list(int initialCapacity)
Primitive constructor. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c)
Helper function to create a new List containing three Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d)
Helper function to create a new List containing four Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e)
Helper function to create a new List containing five Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f)
Helper function to create a new List containing six Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f,
java.lang.Object g)
Helper function to create a new List containing seven Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f,
java.lang.Object g,
java.lang.Object h)
Helper function to create a new List containing eight Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f,
java.lang.Object g,
java.lang.Object h,
java.lang.Object i)
Helper function to create a new List containing nine Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f,
java.lang.Object g,
java.lang.Object h,
java.lang.Object i,
java.lang.Object j)
Helper function to create a new List containing ten Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f,
java.lang.Object g,
java.lang.Object h,
java.lang.Object i,
java.lang.Object j,
java.lang.Object k)
Helper function to create a new List containing eleven Objects. |
|
static java.util.List |
list(java.lang.Object a,
java.lang.Object b,
java.lang.Object c,
java.lang.Object d,
java.lang.Object e,
java.lang.Object f,
java.lang.Object g,
java.lang.Object h,
java.lang.Object i,
java.lang.Object j,
java.lang.Object k,
java.lang.Object l)
Helper function to create a new List containing twelve Objects. |
|
static
|
list(T object)
Helper function to create a new List containing one Object. |
|
static
|
list(T a,
T b)
Helper function to create a new List containing two Objects. |
|
static
|
listAddAll(java.util.Collection<T> source)
Returns new List with all the items in source Collection added to it. |
|
static boolean |
listEquals(java.util.List v1,
java.util.List v2)
Determine if the two lists are equal. |
|
static java.lang.String |
listToCSVString(java.util.List l)
Generate a comma separated list of strings from a List. |
|
static
|
listToEnumeration(java.util.List<T> list)
A simple wrapper to convert a List to an Enumeration. |
|
static java.lang.String |
listToString(java.util.List l,
java.lang.String separator)
Generate a string from a list, separating the elements with the specified string. |
|
static
|
minus(java.util.List<T> l1,
java.util.List<T> l2)
Returns values in one list which are not present in the other |
|
static boolean |
nullOrEmptyList(java.util.List<?> list)
Determine if a List is null or empty. |
|
static void |
readExternal(java.util.List l,
java.io.ObjectInput input)
Reads object data from the given input and restores the contents of the given List. |
|
static
|
removeAll(java.util.List<T> l,
T o)
Removes all occurrences of element from the Vector. |
|
static
|
removeElementIdentical(java.util.List<T> l,
T element)
Finds the location of an element in the List using the == operator for comparison. |
|
static void |
removeEqualElements(java.util.List v1,
java.util.List v2)
Removes all elements from the two lists v1 and v2 which are contained in both. |
|
static
|
removeFirstElement(java.util.List<T> l)
Removes and returns the element at index 0, or null if the List is empty. |
|
static
|
removeLastElement(java.util.List<T> l)
Removes and returns the element at the end (size-1), or null if the List is empty. |
|
static java.lang.Object |
replace(java.util.List list,
java.lang.Object o,
java.lang.Object n)
Replaces the element o with n. |
|
static
|
reverse(java.util.List<T> list)
Return a new list with the keys reversed. |
|
static int |
size(java.util.Collection list)
|
|
static void |
sortStrings(java.util.List<java.lang.String> l,
boolean ascending)
Sorts the List's contents. |
|
static void |
sortStrings(java.util.List<java.lang.String> l,
boolean ascending,
boolean ignoreCase)
Sorts the List's contents, presuming all elements are of type String. |
|
static
|
subList(java.util.Collection<V> values,
int fromIndex,
int toIndex)
|
|
static
|
subList(java.lang.Iterable<V> values,
int fromIndex,
int toIndex,
boolean createNewList)
Returns a list which is a sub-collection of values
from index fromIndex (inclusive) to toIndex
(exclusive). |
|
static void |
writeExternal(java.util.List l,
java.io.ObjectOutput output)
Writes the List's data out to the given stream. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.List ImmutableEmptyList
Collections.emptyList()
instead
public static final java.lang.Class ImmutableListClass
Constructor Detail |
---|
public ListUtil()
Method Detail |
---|
public static <T> java.util.List<T> list()
List
:List<X> typesafe = ListUtil.list()
List
:List raw = ListUtil.list()
public static <T> java.util.List<T> list(int initialCapacity)
List
:List<X> typesafe = ListUtil.list()
List
:List raw = ListUtil.list()
initialCapacity
- the initial capacity; must be greater
than or equal to zero
public static <T> java.util.List<T> cloneList(java.util.List<? extends T> l)
l
- the list to clone
public static <V> java.util.List<V> subList(java.lang.Iterable<V> values, int fromIndex, int toIndex, boolean createNewList)
values
from index fromIndex
(inclusive) to toIndex
(exclusive).
values
- the collection of valuesfromIndex
- the beginning index, inclusivetoIndex
- the end index, exclusivecreateNewList
- if true
, this method uses a new
list to create the sublist, else this method attempts to use
a computationally efficient result which may refer to
values
(and so is not modifiable)public static <V> java.util.List<V> subList(java.util.Collection<V> values, int fromIndex, int toIndex)
public static <T> java.util.List<T> arrayToList(T[] array)
array
- the array to use as the initial contents of the
list
public static <T> java.util.List<T> arrayToList(T[] array, boolean copy)
array
- the array to use as the initial contents of the
listcopy
- if true, the array is copied; if false
the array is shared. However internal List operations
may copy or modify the array at a later point, so sharing the
array in a active manner should be avoided.
public static <T> java.util.List<T> collectionToList(java.util.Collection<T> source)
source
- The collection to copy
public static <T> java.util.List<T> listAddAll(java.util.Collection<T> source)
public static java.util.List<java.lang.String> delimitedStringToList(java.lang.String str, char delimiter)
Takes a string in the form "Description.Price.Amount" with a delimiter of '.' and turns it into an list of strings:
list.get(0) = "Description" list.get(1) = "Price" list.get(2) = "Amount"
str
- a string to tokenizedelimiter
- the delimiter to use when tokenizing
StringUtil.delimitedStringToArray(java.lang.String, char)
public static void fromSerializedString(java.util.List l, java.lang.String serialized)
serialized
- String containing serialized list datapublic static java.util.List copyList(java.util.List source)
source
- the source list to copy.
public static java.util.List copyAndSortMapInList(java.util.List list)
list
-
public static <T> void addElementIfAbsent(java.util.List<T> l, T element)
l
- the List to add toelement
- the element to add
java.lang.NullPointerException
- if element is null.public static <T> void addToCollection(java.util.Collection<? super T> collection, T[] toAdd)
toAdd
to the collection
.
collection
- the collection to add the elements to; may not be
null
toAdd
- the array containing the elements to add; may not be
null
public static <T> void addAll(java.util.Collection<? super T> collection, java.lang.Iterable<T> toAdd)
toAdd
to the collection
.
collection
- the collection to add the elements to; may not be
null
toAdd
- the array containing the elements to add; may not be
null
public static <T> void addElementsIfAbsent(java.util.List<T> destList, java.util.Collection<? extends T> aColl)
destList
- the list to add elements toaColl
- a collection of the elements to be added to destListpublic static void appendAndRemoveIfPresent(java.util.List l, java.lang.Object element)
l
- the List to add toelement
- the element to add
java.lang.NullPointerException
- if element is null.public static void appendAndRemoveIfPresent(java.util.List destList, java.util.Collection aColl)
destList
- the list to add elements toaColl
- a collection of the elements to be added to destListpublic static <T> boolean containsIdentical(java.util.List<T> l, T element)
l
- the list to searchelement
- the element to search for; the ==
operator is used for comparison
public static <T> int indexOfIdentical(java.util.List<T> l, T element)
element
- the element to search for. The comparison is
performed using == with each element.l
- the list to search
public static <T> int lastIndexOfIdentical(java.util.List<T> l, T element, int startingAt)
element
- the element to search for. The comparison is
performed using == with each element.l
- the list to searchstartingAt
- the starting element in the list to search
back from
public static <T> int lastIndexOfIdentical(java.util.List<T> l, T element)
element
- the element to search for. The comparison is
performed using == with each element.l
- the list to search
public static <T> boolean removeElementIdentical(java.util.List<T> l, T element)
element
- the element to search for. The comparison is
performed using == with each element.l
- the list to search
public static <T> T firstElement(java.util.List<T> l)
l
- the list to look in
public static <T> T lastElement(java.util.List<T> l)
l
- the list to look in
public static <T> boolean insertElementAfter(java.util.List<T> l, T element, T existingElement)
l
- the list to insert intoelement
- the element to insert into the listexistingElement
- the element to insert after. If
existingElement is null or cannot be found, this
method does nothing
java.lang.NullPointerException
- if element is null.public static <T> boolean insertElementBefore(java.util.List<T> l, T element, T existingElement)
l
- the list to insert intoelement
- the element to insert into the listexistingElement
- the element to insert before. If
existingElement is null or cannot be found, this
method does nothing
java.lang.NullPointerException
- if element is null.public static void sortStrings(java.util.List<java.lang.String> l, boolean ascending)
l
- the List to sortascending
- if true the List will be sorted in
ascending order, if false in descending order
java.lang.ClassCastException
- if the
List's contents are not all Strings, or are not Comparable.public static void sortStrings(java.util.List<java.lang.String> l, boolean ascending, boolean ignoreCase)
l
- the List to sortascending
- if true the List will be sorted in
ascending order, if false in descending orderignoreCase
- if true the List's Strings will be
sorted in a case insensitive manner, if false in a case
sensitive manner
java.lang.ClassCastException
- if the List's contents are not
all Strings.public static void copyInto(java.util.List l, java.lang.Object[] anArray, int startingAt)
l
- the List to copy intoanArray
- the array to copy the List's elements
into. Any elements existing in anArray beyond the count
of elements copied from this List are left unchanged.startingAt
- the location in anArray to begin
copying intopublic static int copyInto(java.util.List from, java.util.List to, int fromIndex, int length)
length
elements of the list from
to the list
to
starting at the specified fromIndex
.
Regardless of how big length
actually is, we stop copying
when we reach the end of from
. The actual number of elements
copied is returned.
from
- the List
to copy fromto
- the List
to copy tofromIndex
- the index of the first element in from
to copylength
- the number of elements of from
to copy
public static <T> java.util.List<T> list(T object)
object
- the Object to add to the List
public static <T> java.util.List<T> list(T a, T b)
a
- the first Object to add to the Listb
- the second Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f, java.lang.Object g)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the Listg
- the seventh Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f, java.lang.Object g, java.lang.Object h)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the Listg
- the seventh Object to add to the Listh
- the eighth Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f, java.lang.Object g, java.lang.Object h, java.lang.Object i)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the Listg
- the seventh Object to add to the Listh
- the eighth Object to add to the Listi
- the ninth Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f, java.lang.Object g, java.lang.Object h, java.lang.Object i, java.lang.Object j)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the Listg
- the seventh Object to add to the Listh
- the eighth Object to add to the Listi
- the ninth Object to add to the Listj
- the tenth Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f, java.lang.Object g, java.lang.Object h, java.lang.Object i, java.lang.Object j, java.lang.Object k)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the Listg
- the seventh Object to add to the Listh
- the eighth Object to add to the Listi
- the ninth Object to add to the Listj
- the tenth Object to add to the Listk
- the eleventh Object to add to the List
public static java.util.List list(java.lang.Object a, java.lang.Object b, java.lang.Object c, java.lang.Object d, java.lang.Object e, java.lang.Object f, java.lang.Object g, java.lang.Object h, java.lang.Object i, java.lang.Object j, java.lang.Object k, java.lang.Object l)
a
- the first Object to add to the Listb
- the second Object to add to the Listc
- the third Object to add to the Listd
- the fourth Object to add to the Liste
- the fifth Object to add to the Listf
- the sixth Object to add to the Listg
- the seventh Object to add to the Listh
- the eighth Object to add to the Listi
- the ninth Object to add to the Listj
- the tenth Object to add to the Listk
- the eleventh Object to add to the Listl
- the twelfth Object to add to the List
public static int getListSize(java.util.List<?> list)
list
- a list to check the size of. null is an
acceptable value for this argument.
public static boolean nullOrEmptyList(java.util.List<?> list)
list
- a List object to check
public static <T> T removeFirstElement(java.util.List<T> l)
l
- the List object to process
public static <T> T removeLastElement(java.util.List<T> l)
l
- the List object to process
public static <T> void removeAll(java.util.List<T> l, T o)
l
- the list to remove fromo
- the element to remove.public static void removeEqualElements(java.util.List v1, java.util.List v2)
v1
- the first Listv2
- the second Listpublic static java.util.List equalElements(java.util.List l1, java.util.List l2)
l1
- the first Listl2
- the second List
public static java.lang.String listToCSVString(java.util.List l)
l
- a List of objects to put into the string
public static java.lang.String listToString(java.util.List l, java.lang.String separator)
l
- a List of objects to put into the stringseparator
- a String that should separate each element of l
public static boolean listEquals(java.util.List v1, java.util.List v2)
v1
- the first Listv2
- the second List
public static <T> java.util.List<T> reverse(java.util.List<T> list)
list
- the list to reverse
public static java.lang.Object replace(java.util.List list, java.lang.Object o, java.lang.Object n)
list
- the list to searcho
- which element to replacen
- the element to replace the existing element with
java.lang.NullPointerException
- if n is
nullpublic static <T> java.util.List<T> immutableList(java.util.List<? extends T> l)
public static void writeExternal(java.util.List l, java.io.ObjectOutput output) throws java.io.IOException
l
- the list to write fromoutput
- the stream to write the object to
java.io.IOException
- Includes any I/O exceptions that may occurpublic static void readExternal(java.util.List l, java.io.ObjectInput input) throws java.io.IOException, java.lang.ClassNotFoundException
input
- the stream to read data from in order to restore the objectl
- the list to read into
java.io.IOException
- if I/O errors occur
java.lang.ClassNotFoundException
- If the class for an object being
restored cannot be found.public static <T> boolean isSubList(java.util.List<T> subList, java.util.List<T> l)
subList
is the subList of
list l
.
For example, if list l is A[1..n], list subList is B[1..m], l contains the whole list subList if and only if A1, A2, A3, A4, ..., Am+2, ... An B1, B2, ..., Bm such that A[3] == B[1], A[4] == B[2], ... , A[m+2] = B[m]
subList
- the sub listl
- the containing list
true
if l contains all the elements of subList
consecutivelypublic static <T> boolean hasSameElements(java.util.List<T> l1, java.util.List<T> l2)
l1
- one listl2
- the other list
true
if the content of the two lists is identical
without necessary using the same orderpublic static <T> java.util.List<T> minus(java.util.List<T> l1, java.util.List<T> l2)
l1
- one listl2
- the other list
l1
which are not present in
the otherpublic static ListUtil.Comparator createComparator(java.util.Comparator elementComparator)
ListUtil.Comparator
with the
specified elementComparator
.
elementComparator
- the element Comparator
the
ListUtil.Comparator
will use
public static int compare(java.util.List first, java.util.List second, java.util.Comparator elementComparator)
first
and second
and returns a negative, zero or positive integer as first
is
less than, equal to or greater than second
, respectively.
Everything else being equal, longer lists are greater than shorter lists.
first
- the first List
; may not be null
second
- the second List
; may not be null
elementComparator
- the Comparator
to be used
when comparing elements of the Lists
; may be
null
in which case the elements are assumed to
be Comparables
java.lang.NullPointerException
- if either of first
or
second
is null
public static <T> java.util.Enumeration<T> listToEnumeration(java.util.List<T> list)
list
- the List to convert to an Enumeration
public static java.util.List diff(java.util.List change, java.util.List baseline)
public static java.util.List[] getChunkedLists(java.util.List list, int maxChunkSize)
public static int size(java.util.Collection list)
public static <T> java.util.List<T> concatenate(java.util.List<T>... lists)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |