@GwtCompatible public final class MoreObjects extends Object
Object, and are not already provided in
 Objects.
 See the Guava User Guide on writing
 Object methods with MoreObjects.
Objects)| Modifier and Type | Class and Description | 
|---|---|
| static class  | MoreObjects.ToStringHelperSupport class for  toStringHelper(java.lang.Object). | 
| Modifier and Type | Method and Description | 
|---|---|
| static <T> T | firstNonNull(T first,
                        T second)Returns the first of two given parameters that is not  null, if either is, or otherwise
 throws aNullPointerException. | 
| static MoreObjects.ToStringHelper | toStringHelper(Class<?> clazz)Creates an instance of  MoreObjects.ToStringHelperin the same manner astoStringHelper(Object), but using the simple name ofclazzinstead of using an
 instance'sObject.getClass(). | 
| static MoreObjects.ToStringHelper | toStringHelper(Object self)Creates an instance of  MoreObjects.ToStringHelper. | 
| static MoreObjects.ToStringHelper | toStringHelper(String className)Creates an instance of  MoreObjects.ToStringHelperin the same manner astoStringHelper(Object), but usingclassNameinstead of using an instance'sObject.getClass(). | 
@CheckReturnValue public static <T> T firstNonNull(@Nullable T first, @Nullable T second)
null, if either is, or otherwise
 throws a NullPointerException.
 Note: if first is represented as an Optional, this can be
 accomplished with first.or(second). That approach also allows for
 lazy evaluation of the fallback instance, using first.or(supplier).
first if it is non-null; otherwise second if it is non-nullNullPointerException - if both first and second are nullObjects.firstNonNull()).@CheckReturnValue public static MoreObjects.ToStringHelper toStringHelper(Object self)
MoreObjects.ToStringHelper.
 This is helpful for implementing Object.toString().
 Specification by example: 
   // Returns "ClassName{}"
   MoreObjects.toStringHelper(this)
       .toString();
   // Returns "ClassName{x=1}"
   MoreObjects.toStringHelper(this)
       .add("x", 1)
       .toString();
   // Returns "MyObject{x=1}"
   MoreObjects.toStringHelper("MyObject")
       .add("x", 1)
       .toString();
   // Returns "ClassName{x=1, y=foo}"
   MoreObjects.toStringHelper(this)
       .add("x", 1)
       .add("y", "foo")
       .toString();
   // Returns "ClassName{x=1}"
   MoreObjects.toStringHelper(this)
       .omitNullValues()
       .add("x", 1)
       .add("y", null)
       .toString();
   }
 Note that in GWT, class names are often obfuscated.
self - the object to generate the string for (typically this), used only for its
     class nameObjects.toStringHelper()).@CheckReturnValue public static MoreObjects.ToStringHelper toStringHelper(Class<?> clazz)
MoreObjects.ToStringHelper in the same manner as toStringHelper(Object), but using the simple name of clazz instead of using an
 instance's Object.getClass().
 Note that in GWT, class names are often obfuscated.
clazz - the Class of the instanceObjects.toStringHelper()).@CheckReturnValue public static MoreObjects.ToStringHelper toStringHelper(String className)
MoreObjects.ToStringHelper in the same manner as toStringHelper(Object), but using className instead of using an instance's Object.getClass().className - the name of the instance typeObjects.toStringHelper()).Copyright © 2010-2015. All Rights Reserved.