Class CompareLists

java.lang.Object
org.gvsig.utils.CompareLists

public class CompareLists extends Object
This class has methods to compare lists of objects
Author:
Pablo Piqueras Bartolomé (p_queras@hotmail.com)
  • Constructor Details

    • CompareLists

      public CompareLists()
  • Method Details

    • compare

      public static boolean compare(List l1, List l2)
      Compares two lists of elements, using the value returned of the toString() method of each element.
      Each element must also implement the Comparable interface.
      This method considers case sensitive .
      Parameters:
      l1 - First list of items. @see java.util.List
      l2 - Second list of items. @see java.util.List
      Returns:
      True if the two lists have the same number of elements, and elements are in the same position of the two lists and have the same String value .
    • compareIgnoringCaseSensitive

      public static boolean compareIgnoringCaseSensitive(List l1, List l2)
      Compares two lists of elements, using the value returned of the toString() method of each element.
      Each element must also implement the Comparable interface.
      This method ignores case sensitive during the comparation.
      Parameters:
      l1 - First list of items. @see java.util.List
      l2 - Second list of items. @see java.util.List
      Returns:
      True if the two lists have the same number of elements, and elements are in the same position of the two lists and have the same String value .
    • compare

      public static boolean compare(List l1, List l2, Comparator comp)
      Compares two lists of elements, using the value returned of the toString() method of each element.
      Each element must also implement the Comparable interface.
      Parameters:
      l1 - First list of items. @see java.util.List
      l2 - Second list of items. @see java.util.List
      comp - A class which implements the compare method of the Comparator interface .
      Returns:
      True if the two lists have the same number of elements, and elements are in the same position of the two lists and have the same String value .
    • compareIgnoringCaseSensitive

      public static boolean compareIgnoringCaseSensitive(List l1, List l2, Comparator comp)
      Compares two lists of elements, using the value returned of the toString() method of each element.
      Each element must also implement the Comparable interface.
      This method ignores case sensitive during the comparation.
      Parameters:
      l1 - First list of items. @see java.util.List
      l2 - Second list of items. @see java.util.List
      comp - A class which implements the compare method of the Comparator interface .
      Returns:
      True if the two lists have the same number of elements, and elements are in the same position of the two lists and have the same String value .