MCPcopy
hub / github.com/google/guava / useForNull

Method useForNull

guava/src/com/google/common/base/Joiner.java:276–294  ·  view source on GitHub ↗

Returns a joiner with the same behavior as this one, except automatically substituting {@code nullText} for any provided null elements.

(String nullText)

Source from the content-addressed store, hash-verified

274 * nullText} for any provided null elements.
275 */
276 public Joiner useForNull(String nullText) {
277 checkNotNull(nullText);
278 return new Joiner(this) {
279 @Override
280 CharSequence toString(@Nullable Object part) {
281 return (part == null) ? nullText : Joiner.this.toString(part);
282 }
283
284 @Override
285 public Joiner useForNull(String nullText) {
286 throw new UnsupportedOperationException("already specified useForNull");
287 }
288
289 @Override
290 public Joiner skipNulls() {
291 throw new UnsupportedOperationException("already specified useForNull");
292 }
293 };
294 }
295
296 /**
297 * Returns a joiner with the same behavior as this joiner, except automatically skipping over any

Callers 8

test_useForNull_twiceMethod · 0.95
TypesClass · 0.45
useForNullMethod · 0.45
testUseForNullMethod · 0.45
testNullPointersMethod · 0.45
testEqualsUsingMethod · 0.45

Calls 1

checkNotNullMethod · 0.45

Tested by 6

test_useForNull_twiceMethod · 0.76
testUseForNullMethod · 0.36
testNullPointersMethod · 0.36
testEqualsUsingMethod · 0.36