Skip to content

Commit d00901b

Browse files
mkargmichael-o
authored andcommitted
Replaced custom code by Java 7 methods (#30)
This closes #30
1 parent d0b12c6 commit d00901b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/org/codehaus/plexus/util/StringUtils.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.util.Iterator;
5858
import java.util.Locale;
5959
import java.util.Map;
60+
import java.util.Objects;
6061
import java.util.StringTokenizer;
6162

6263
/**
@@ -258,10 +259,12 @@ public static boolean isNotBlank( String str )
258259
* @param str1 the first string
259260
* @param str2 the second string
260261
* @return <code>true</code> if the Strings are equal, case sensitive, or both <code>null</code>
262+
* @see Objects#equals(Object, Object)
261263
*/
264+
@Deprecated
262265
public static boolean equals( String str1, String str2 )
263266
{
264-
return ( str1 == null ? str2 == null : str1.equals( str2 ) );
267+
return Objects.equals( str1, str2 );
265268
}
266269

267270
/**
@@ -2038,7 +2041,9 @@ public static boolean isNumericSpace( String str )
20382041
*
20392042
* @param obj the Object to check
20402043
* @return the passed in Object's toString, or blank if it was <code>null</code>
2044+
* @see Objects#toString(Object, String)
20412045
*/
2046+
@Deprecated
20422047
public static String defaultString( Object obj )
20432048
{
20442049
return defaultString( obj, "" );
@@ -2053,10 +2058,12 @@ public static String defaultString( Object obj )
20532058
* @param obj the Object to check
20542059
* @param defaultString the default String to return if str is <code>null</code>
20552060
* @return the passed in string, or the default if it was <code>null</code>
2061+
* @see Objects#toString(Object, String)
20562062
*/
2063+
@Deprecated
20572064
public static String defaultString( Object obj, String defaultString )
20582065
{
2059-
return ( obj == null ) ? defaultString : obj.toString();
2066+
return Objects.toString( obj, defaultString );
20602067
}
20612068

20622069
// Reversing

0 commit comments

Comments
 (0)