Class ObjectUtils
java.lang.Object
org.eclipse.nebula.widgets.nattable.util.ObjectUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Collection<T>asCollection(Iterator<T> iterator) Transfers the given iterator to an unmodifiable collection.static int[]asIntArray(Collection<Integer> collection) static <T> List<T>asList(Collection<T> collection) static <T> Collection<T>asOrderedCollection(Iterator<T> iterator, Comparator<T> comparator) Transfers the given iterator into an unmodifiable ordered collection based on the given comparator.static booleancollectionsEqual(Collection c1, Collection c2) Checks if the passed collections are equal or not.static <T> TgetFirstElement(List<T> list) static <T> TgetLastElement(List<T> list) static Datestatic intstatic intgetRandomNumber(int max) static booleanstatic <T> booleanisEmpty(Collection<T> collection) static booleanisNotEmpty(String string) static <T> booleanisNotEmpty(Collection<T> collection) static booleanstatic booleanstatic <T> StringtoString(Collection<T> collection) static <T> StringtoString(T[] array)
-
Method Details
-
asCollection
Transfers the given iterator to an unmodifiable collection.- Type Parameters:
T- The type of the objects contained in the iterator.- Parameters:
iterator- The iterator to transfer.- Returns:
- Contents of the iterator as an unmodifiable Collection.
-
asList
-
asIntArray
-
asOrderedCollection
Transfers the given iterator into an unmodifiable ordered collection based on the given comparator.- Type Parameters:
T- The type of the objects contained in the iterator.- Parameters:
iterator- The iterator to transfer.comparator- The comparator to order the collection.- Returns:
- Contents of the iterator as an unmodifiable ordered Collection.
-
toString
-
toString
-
isEmpty
- Type Parameters:
T- The type of objects in the collection.- Parameters:
collection- The collection to check.- Returns:
trueif the given collection isnullor empty.
-
isEmpty
- Parameters:
string- The string to check.- Returns:
trueif the given string isnullor empty.
-
isNotEmpty
- Parameters:
string- The string to check.- Returns:
trueif the given string is notnulland not empty.
-
isNotEmpty
- Type Parameters:
T- The type of objects in the collection.- Parameters:
collection- The collection to check.- Returns:
trueif the given collection is notnulland not empty.
-
isNull
- Parameters:
object- The object to check.- Returns:
trueif the given object reference isnull.
-
isNotNull
- Parameters:
object- The object to check.- Returns:
trueif the given object reference is notnull.
-
getRandomDate
- Returns:
- a random Date
-
getRandomNumber
public static int getRandomNumber()- Returns:
- 4 digit random Integer number
-
getRandomNumber
public static int getRandomNumber(int max) - Parameters:
max- the upper bound (exclusive)- Returns:
- random Integer number between 0 and parameter max
-
getLastElement
-
getFirstElement
-
collectionsEqual
Checks if the passed collections are equal or not. Checks for content equality and does not take the order of values in the collection into account.- Parameters:
c1- The first collection.c2- The second collection.- Returns:
trueif the passed collections contain the same values even in different order,falseif the collections do not contain the same values.- Since:
- 2.1
-