Releases: okkam-it/okkam-awesome-utils
Releases · okkam-it/okkam-awesome-utils
1.0.2
OkkamArrays:
+ int indexOf(T[] array, T obj) -> return the position of the object into the array. -1 if not exists
+ ArrayList<T> toArrayList(T[] array) -> Build a list based on the array
+ ArrayList<T> toArrayListStartingWith(T[] array, T... elems) -> Build a list based on the array, prepending a set of elements
+ ArrayList<T> toArrayListEndingWith(T[] array, T... elems) -> Build a list based on the array, appending a set of elements
+ T[] addAll(T[] array, T... addElmt) -> Append a set of elements to an array
+ T[] addAll(T[] array, List<T> addElmts) -> Append a list of elements to an array
OkkamChars:
+ boolean isBetween(char start, char end, char toCheck) -> Returns true if the char is between the range
+ boolean isStrictBetween(char start, char end, char toCheck) -> Returns true if the char is strict between the range
OkkamCollections:
+ List<T> toList(Collection<T> coll) -> Build a list based on the input collection
OkkamComparators:
+ Comparator<T> sortAscending() -> Comparator to sort ascending (or alphabetically for strings)
+ Comparator<T> sortDescending() -> Comparator to sort descending (or reverse alphabetically for strings)
OkkamGeoUtils:
+ double calculateDistance(double lat1, double lon1, double lat2, double lon2) -> return the distance (in meters) between 2 WGS84 points
OkkamLists:
+ List<T> appendElements(List<T> list, T... elements) -> Append elements to a list
+ List<T> prependElements(List<T> list, T... elements) -> Prepend elements to a list
+ boolean addIfEquals(List<T> list, T elemToAdd, T elemToCompare) -> Add elemToAdd to the list if it is equals to elemToCompare
+ boolean addIfEquals(List<T> list, T elemToAdd, T1 element1, T1 element2) -> Add elemToAdd to the list if element1 is equals to element2
+ List<T> addIfNotContained(List<T> list, T... elements) -> append elements to the list if they are not already contained
+ List<T> createArrayListIfNull(List<T> list) -> create an empty list if the input is null. Return the input otherwise
OkkamMaps:
+ List<V> valuesToList(Map<?, V> map) -> Transform the values of a map into a List
+ Map<K, V> putIfNotExists(Map<K, V> map, K key, V value) -> Put an element to a map only if the key does not exist
OkkamSets:
+ Set<T> addIfNotNull(Set<T> set, T element) -> Add element to a set if it is not empty
+ Set<T> createIfNull(Set<T> set) -> create an empty set if the input is null. Return the input set otherwise
+ Set<T> addSafeToHashSet(Set<T> set, T... elements) -> Add elements to the HashSet. Create a new HashSet if the input set is null (initialized with elements).
OkkamStrings:
+ boolean isEmptyOrNull(String string, boolean trim)) -> Returns true if the string is null or empty
+ boolean isEmptyAndNotNull(String string, boolean trim)) -> Check if the string is empty and not null
+ boolean noOneIsEmptyOrNull(boolean trim, String... strings) -> Check if the strings are not empty and not blank
+ boolean isOneOf(String string, boolean trim, String... ors) -> Check if the string is one of the specified values. String could also be null, in this case the method will return true if there's a null element in the passed array
+ String trimIfNecessary(boolean trim, String src) -> Returns the trimmed string when not null and necessary (i.e. trim is true)
+ StringBuilder appendAll(StringBuilder sb, T... elements) -> Append all elements to the string builder
+ String separateArrayBy(T[] array, String separator) -> Generate a String based on array values and separator
+ String separateTreeMapValuesBy(Map<T, String> map, String separator) -> Generate a String based on map values and separator. Pass a TreeMap to guarantee ordering
+ String[] splitByChar(String stringToSplit, char charToSplit) -> Split the string by char. Trailing empty array cells will not be removed.
+ String concatRange(T[] arr, String separator, int from, int to) -> Generate a String by concatenating Array fields between 'from' and 'to' position.
+ String concatRanges(T[] arr, String separator, int... ranges) -> Generate a String by concatenating Array fields between some position ranges.
+ String duplicate(String stringToDuplicate, int times) --> Duplicate the string n times.
1.0.1
Features
OkkamArrays:
+ int indexOf(T[] array, T obj) -> return the position of the object into the array. -1 if not exists
+ ArrayList<T> toArrayList(T[] array) -> Build a list based on the array
+ ArrayList<T> toArrayListStartingWith(T[] array, T... elems) -> Build a list based on the array, prepending a set of elements
+ ArrayList<T> toArrayListEndingWith(T[] array, T... elems) -> Build a list based on the array, appending a set of elements
+ T[] addAll(T[] array, T... addElmt) -> Append a set of elements to an array
+ T[] addAll(T[] array, List<T> addElmts) -> Append a list of elements to an array
OkkamChars:
+ boolean isBetween(char start, char end, char toCheck) -> Returns true if the char is between the range
+ boolean isStrictBetween(char start, char end, char toCheck) -> Returns true if the char is strict between the range
OkkamComparators:
+ Comparator<T> sortAscending() -> Comparator to sort ascending (or alphabetically for strings)
+ Comparator<T> sortDescending() -> Comparator to sort descending (or reverse alphabetically for strings)
OkkamCollections:
+ List<T> toList(Collection<T> coll) -> Build a list based on the input collection
OkkamLists:
+ List<T> appendElements(List<T> list, T... elements) -> Append elements to a list
+ List<T> prependElements(List<T> list, T... elements) -> Prepend elements to a list
+ boolean addIfEquals(List<T> list, T elemToAdd, T elemToCompare) -> Add elemToAdd to the list if it is equals to elemToCompare
+ boolean addIfEquals(List<T> list, T elemToAdd, T1 element1, T1 element2) -> Add elemToAdd to the list if element1 is equals to element2
+ List<T> addIfNotContained(List<T> list, T... elements) -> append elements to the list if they are not already contained
+ List<T> createArrayListIfNull(List<T> list) -> create an empty list if the input is null. Return the input otherwise
OkkamMaps:
+ List<V> valuesToList(Map<?, V> map) -> Transform the values of a map into a List
+ Map<K, V> putIfNotExists(Map<K, V> map, K key, V value) -> Put an element to a map only if the key does not exist
OkkamSets:
+ Set<T> addIfNotNull(Set<T> set, T element) -> Add element to a set if it is not empty
+ Set<T> createIfNull(Set<T> set) -> create an empty set if the input is null. Return the input set otherwise
+ Set<T> addSafeToHashSet(Set<T> set, T... elements) -> Add elements to the HashSet. Create a new HashSet if the input set is null (initialized with elements).
OkkamStrings:
+ boolean isEmptyOrNull(String string, boolean trim)) -> Returns true if the string is null or empty
+ boolean isEmptyAndNotNull(String string, boolean trim)) -> Check if the string is empty and not null
+ boolean noOneIsEmptyOrNull(boolean trim, String... strings) -> Check if the strings are not empty and not blank
+ boolean isOneOf(String string, boolean trim, String... ors) -> Check if the string is one of the specified values. String could also be null, in this case the method will return true if there's a null element in the passed array
+ String trimIfNecessary(boolean trim, String src) -> Returns the trimmed string when not null and necessary (i.e. trim is true)
+ StringBuilder appendAll(StringBuilder sb, T... elements) -> Append all elements to the string builder
+ String separateArrayBy(T[] array, String separator) -> Generate a String based on array values and separator
+ String separateTreeMapValuesBy(Map<T, String> map, String separator) -> Generate a String based on map values and separator. Pass a TreeMap to guarantee ordering
1.0.0
Release Notes:
New Features:
ArrayUtils:
+ int getObjPos(T[] array, T obj) -> return the position of the object into the array. -1 if not exists
+ List<T> toList(T[] array) -> Build a list based on the array
+ List<T> toListStartingWith(T elem, T[] array) -> Build a list based on the array, prepending an element
+ List<T> toListEndingWith(T[] array, T elem) -> Build a list based on the array, appending an element
+ T[] addElementToArray(T[] array, T addElmt) -> Append a single element to an array
+ T[] addElementsToArray(T[] array, List<T> addElmts) -> Append a list of elements to an array
CharUtils:
+ boolean isBetween(char start, char end, char toCheck) -> Returns true if the char is between the range
+ boolean isStrictBetween(char start, char end, char toCheck) -> Returns true if the char is strict between the range
CollectionUtils:
+ List<T> toList(Collection<T> coll) -> Build a list based on the input collection
ListUtils:
+ List<T> appendElementsToList(List<T> list, T... elements) -> Append elements to a list
+ List<T> prependElementsToList(List<T> list, T... elements) -> Prepend elements to a list
+ List<T> addIfEquals(List<T> list, T element1, T element2) -> Add element1 to the list if it is equals to element2
+ List<T> addIfEquals(List<T> list, T elemToAdd, T1 element1, T1 element2) -> Add elemToAdd to the list if element1 is equals to element
+ List<T> addIfNotContained(List<T> list, T... elements) -> append elements to the list if they are not already contained
+ List<T> createIfNull(List<T> list) -> create an empty list if the input is null. Return the input otherwise
MapUtils:
+ List<T> keySetToList(Map<T, ?> map) -> Transform the key set of a map into a List
+ List<T> valuesToList(Map<?, T> map) -> Transform the values of a map into a List
+ Map<T, T> putIfNotExists(Map<T, T> map, T key, T value) -> Put an element to a map only if the key does not exist
SetUtils:
+ List<T> toList(Set<T> set) -> Build a list based on the input set
+ Set<T> addIfNotEmpty(Set<T> set, T element) -> Add element to a set if it is not empty
+ Set<T> createIfNull(Set<T> set) -> create an empty set if the input is null. Return the input set otherwise
StringUtils:
+ boolean isEmptyOrNull(String string) -> Returns true if the string is null or empty
+ boolean isNullEmptyOrBlank(String string) -> Returns true if the string is null or empty or blank
+ boolean isEmptyOrBlanNotNull(String string) -> Returns true if the string is empty or blank
+ StringBuilder appendAll(StringBuilder sb, T... elements) -> Append all elements to the string builder
+ boolean noOneIsEmptyNorBlank(String... strings) -> Return true if there are not empty or blank strings
+ boolean noOneIsEmpty(String... strings) -> Return true if there are not empty strings
+ boolean isEmptyBlankOr(String string, String... ors) -> Returns true if the string is empty, blank, or one of the ors strings
+ String separateArrayBy(T[] array, String separator) -> Generate a String based on array values and separator
+ String separateTreeMapValuesBy(Map<T, String> map, String separator) -> Generate a String based on map values and separator. Pass a TreeMap to guarantee ordering
FlinkMappers:
+ JacksonObjectMapper<T> -> Maps input pojo T into a Jackson Object string