Guava Objects Class - Guava

What is objects Class?

Objects class facilitates helper functions applicable to all objects such as equals, hashCode, etc.

Class Declaration

Here’s the declaration for com.google.common.base.Objects class:

Class Methods

Sr.No

Method & Description

1

static boolean equal(Object a, Object b)

Determines whether two possibly-null objects are equal.

2

static <T> T firstNonNull(T first, T second)

Deprecated. Use MoreObjects.firstNonNull(T, T) instead. This method is scheduled for removal in June 2016.

3

static int hashCode(Object... objects)

Generates a hash code for multiple values.

4

static Objects.ToStringHelper toStringHelper(Class<?> clazz)

Deprecated. Use MoreObjects.toStringHelper(Class) instead. This method is scheduled for removal in June 2016

5

static Objects.ToStringHelper toStringHelper(Object self)

Deprecated. Use MoreObjects.toStringHelper(Object) instead. This method is scheduled for removal in June 2016.

6

static Objects.ToStringHelper toStringHelper(String className)

Deprecated. Use MoreObjects.toStringHelper(String) instead. This method is scheduled for removal in June 2016.

Methods Inherited

This class inherits methods from the following class:
  • java.lang.Object

Example of Objects class

Let’s create the following java program using any editor of your choice in say C:/> Guava.
GuavaTester.java

Verify the Result

Compile the class using javac compiler as follows:
Now run the GuavaTester to see the result.
See the result.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Guava Topics