Skip to content

Commit

Permalink
Replaced custom code by Java 7 methods (#30)
Browse files Browse the repository at this point in the history
This closes #30
  • Loading branch information
mkarg authored and michael-o committed Jul 3, 2019
1 parent d0b12c6 commit d00901b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/codehaus/plexus/util/StringUtils.java
Expand Up @@ -57,6 +57,7 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.StringTokenizer;

/**
Expand Down Expand Up @@ -258,10 +259,12 @@ public static boolean isNotBlank( String str )
* @param str1 the first string
* @param str2 the second string
* @return <code>true</code> if the Strings are equal, case sensitive, or both <code>null</code>
* @see Objects#equals(Object, Object)
*/
@Deprecated
public static boolean equals( String str1, String str2 )
{
return ( str1 == null ? str2 == null : str1.equals( str2 ) );
return Objects.equals( str1, str2 );
}

/**
Expand Down Expand Up @@ -2038,7 +2041,9 @@ public static boolean isNumericSpace( String str )
*
* @param obj the Object to check
* @return the passed in Object's toString, or blank if it was <code>null</code>
* @see Objects#toString(Object, String)
*/
@Deprecated
public static String defaultString( Object obj )
{
return defaultString( obj, "" );
Expand All @@ -2053,10 +2058,12 @@ public static String defaultString( Object obj )
* @param obj the Object to check
* @param defaultString the default String to return if str is <code>null</code>
* @return the passed in string, or the default if it was <code>null</code>
* @see Objects#toString(Object, String)
*/
@Deprecated
public static String defaultString( Object obj, String defaultString )
{
return ( obj == null ) ? defaultString : obj.toString();
return Objects.toString( obj, defaultString );
}

// Reversing
Expand Down

0 comments on commit d00901b

Please sign in to comment.