Skip to content

Commit 8ff79e1

Browse files
EclixalGoogle Java Core Libraries
authored andcommitted
Add documentation to a couple of Platform methods.
Closes #5432. RELNOTES=n/a PiperOrigin-RevId: 363437888
1 parent 2cc42ec commit 8ff79e1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

android/guava/src/com/google/common/base/Platform.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,22 @@ static boolean stringIsNullOrEmpty(@NullableDecl String string) {
5858
return string == null || string.isEmpty();
5959
}
6060

61+
/**
62+
* Returns the string if it is not null, or an empty string otherwise.
63+
*
64+
* @param string the string to test and possibly return
65+
* @return {@code string} if it is not null; {@code ""} otherwise
66+
*/
6167
static String nullToEmpty(@NullableDecl String string) {
6268
return (string == null) ? "" : string;
6369
}
6470

71+
/**
72+
* Returns the string if it is not empty, or a null string otherwise.
73+
*
74+
* @param string the string to test and possibly return
75+
* @return {@code string} if it is not empty; {@code null} otherwise
76+
*/
6577
static String emptyToNull(@NullableDecl String string) {
6678
return stringIsNullOrEmpty(string) ? null : string;
6779
}

guava/src/com/google/common/base/Platform.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,22 @@ static boolean stringIsNullOrEmpty(@Nullable String string) {
5858
return string == null || string.isEmpty();
5959
}
6060

61+
/**
62+
* Returns the string if it is not null, or an empty string otherwise.
63+
*
64+
* @param string the string to test and possibly return
65+
* @return {@code string} if it is not null; {@code ""} otherwise
66+
*/
6167
static String nullToEmpty(@Nullable String string) {
6268
return (string == null) ? "" : string;
6369
}
6470

71+
/**
72+
* Returns the string if it is not empty, or a null string otherwise.
73+
*
74+
* @param string the string to test and possibly return
75+
* @return {@code string} if it is not empty; {@code null} otherwise
76+
*/
6577
static String emptyToNull(@Nullable String string) {
6678
return stringIsNullOrEmpty(string) ? null : string;
6779
}

0 commit comments

Comments
 (0)