Class OCollections
java.lang.Object
com.orientechnologies.common.util.OCollections
Set of utility methods to work with collections.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intindexOf(int[] array, int object) This method is used to find a number in an array.static intindexOf(Object[] array, Comparable object) This method is used to find an item in an array.static <T> intindexOf(List<T> list, T object, Comparator<T> comparator) This method is used to find item in collection using passed in comparator.static StringCreate a string representation of all objects in the given Iterable.
-
Constructor Details
-
OCollections
public OCollections()
-
-
Method Details
-
indexOf
This method is used to find item in collection using passed in comparator. Only 0 value (requested object is found) returned by comparator is taken into account the rest is ignored.- Type Parameters:
T- Type of collection elements.- Parameters:
list- List in which value should be found.object- Object to find.comparator- Comparator is sued for search.- Returns:
- Index of found item or
-1otherwise.
-
indexOf
This method is used to find an item in an array.- Parameters:
array- Array in which value should be found.object- Object to find.- Returns:
- Index of found item or
-1otherwise.
-
indexOf
public static int indexOf(int[] array, int object) This method is used to find a number in an array.- Parameters:
array- Array of integers in which value should be found.object- number to find.- Returns:
- Index of found item or
-1otherwise.
-
toString
Create a string representation of all objects in the given Iterable. example : [value1,value2,value3]- Parameters:
iterable-- Returns:
- String
-