Class Util


  • public class Util
    extends Object
    Collection of comparison and sotr utility methods.
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • strCompare

        public static boolean strCompare​(String str1,
                                         String str2)
        Compare two string - true if both not null and equal
        Returns:
      • strCompareCI

        public static boolean strCompareCI​(String str1,
                                           String str2)
        Compare two string case insensitive - true if both not null and equal
        Returns:
      • strCompareTrimmed

        public static boolean strCompareTrimmed​(String str1,
                                                String str2)
        Compare two string case insensitive - true if both not null and equal
        Returns:
      • strCompareTrimmedCI

        public static boolean strCompareTrimmedCI​(String str1,
                                                  String str2)
        Compare two string case insensitive - true if both not null and equal
        Returns:
      • intCompare

        public static boolean intCompare​(Integer int1,
                                         Integer int2)
        Compare two Integers
        Parameters:
        int1 -
        int2 -
        Returns:
      • notifyException

        public static void notifyException​(String localMsg,
                                           Exception e,
                                           org.apache.log4j.Logger l)
        Notify exception
        Parameters:
        localMsg -
        e -
        l -
      • sortByValueInc

        public static <K,​V extends Comparable<? super V>> Map<K,​V> sortByValueInc​(Map<K,​V> map)
        Sort a map by increasing value
        Parameters:
        map -
        Returns:
      • sortByValueDec

        public static <K,​V extends Comparable<? super V>> Map<K,​V> sortByValueDec​(Map<K,​V> map)
        Sort a map by decreasing value
        Parameters:
        map -
        Returns:
      • computeLevenshteinDistance

        public static int computeLevenshteinDistance​(CharSequence lhs,
                                                     CharSequence rhs)
        Levenshtein Distance computation
        Parameters:
        lhs -
        rhs -
        Returns:
      • computeMetricLCS

        public static double computeMetricLCS​(String lhs,
                                              String rhs)
        Compute the Metric Longest Common Subsequence over normalized strings Equal to 0 means that the strings are identical
        Parameters:
        lhs -
        rhs -
        Returns:
      • fromListIntToSetString

        public static Set<String> fromListIntToSetString​(List<Integer> inputList)
        Convert a list of integer in a list of string
        Parameters:
        inputList -
        Returns:
      • main

        public static void main​(String[] args)