Class StandardComparisonStrategy

    • Method Detail

      • instance

        public static StandardComparisonStrategy instance()
        Returns the singleton instance of this class.
        Returns:
        the singleton instance of this class.
      • iterableRemoves

        public void iterableRemoves​(Iterable<?> iterable,
                                    Object value)
        Look for given value in given Iterable according to the implemented comparison strategy, if value is found it is removed from it.
        If given Iterable is null, does nothing.
        Parameters:
        iterable - the Iterable we want remove value from
        value - object to remove from given Iterable
      • iterablesRemoveFirst

        public void iterablesRemoveFirst​(Iterable<?> iterable,
                                         Object value)
        Removes the first value in iterable that matches the value according to the implemented comparison strategy. If given Iterable is null, does nothing.
        Parameters:
        iterable - the Iterable we want remove value from
        value - object to remove from given Iterable
      • stringStartsWith

        public boolean stringStartsWith​(String string,
                                        String prefix)
        Description copied from interface: ComparisonStrategy
        Returns true if string starts with prefix according to the implemented comparison strategy, false otherwise.
        Parameters:
        string - the String we want to look starting prefix
        prefix - the prefix String to look for at string's start
        Returns:
        true if string starts with prefix according to the implemented comparison strategy, false otherwise.
      • stringEndsWith

        public boolean stringEndsWith​(String string,
                                      String suffix)
        Description copied from interface: ComparisonStrategy
        Returns true if string ends with suffix according to the implemented comparison strategy, false otherwise.
        Parameters:
        string - the String we want to look starting suffix
        suffix - the suffix String to look for at string's end
        Returns:
        true if string ends with suffix according to the implemented comparison strategy, false otherwise.
      • stringContains

        public boolean stringContains​(String string,
                                      String sequence)
        Description copied from interface: ComparisonStrategy
        Returns true if given string contains given sequence according to the implemented comparison strategy, false otherwise.
        Parameters:
        string - the string to search sequence in (must not be null)
        sequence - the String to look for in given string
        Returns:
        true if given string contains given sequence according to the implemented comparison strategy, false otherwise.
      • isGreaterThan

        public boolean isGreaterThan​(Object actual,
                                     Object other)
        Description copied from interface: ComparisonStrategy
        Returns true if actual is greater than other, false otherwise.
        Parameters:
        actual - the object to compare to other
        other - the object to compare to actual
        Returns:
        true if actual is greater than other, false otherwise.
      • checkArgumentIsComparable

        private void checkArgumentIsComparable​(Object actual)