- Java util objects android
- Method Summary
- Methods inherited from class java.lang.Object
- Method Detail
- equals
- deepEquals
- hashCode
- hash
- toString
- toString
- compare
- requireNonNull
- requireNonNull
- Class Objects
- Method Summary
- Methods declared in class java.lang.Object
- Method Details
- equals
- deepEquals
- hashCode
- hash
- toString
- toString
- compare
- requireNonNull
- requireNonNull
- isNull
- nonNull
- requireNonNullElse
- requireNonNullElseGet
- requireNonNull
- checkIndex
- Objects Class
- Remarks
- Properties
- Methods
- Explicit Interface Implementations
- Extension Methods
Java util objects android
This class consists of static utility methods for operating on objects. These utilities include null -safe or null -tolerant methods for computing the hash code of an object, returning a string for an object, and comparing two objects.
Method Summary
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.
Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise.
Methods inherited from class java.lang.Object
Method Detail
equals
Returns true if the arguments are equal to each other and false otherwise. Consequently, if both arguments are null , true is returned and if exactly one argument is null , false is returned. Otherwise, equality is determined by using the equals method of the first argument.
deepEquals
Returns true if the arguments are deeply equal to each other and false otherwise. Two null values are deeply equal. If both arguments are arrays, the algorithm in Arrays.deepEquals is used to determine equality. Otherwise, equality is determined by using the equals method of the first argument.
hashCode
hash
Generates a hash code for a sequence of input values. The hash code is generated as if all the input values were placed into an array, and that array were hashed by calling Arrays.hashCode(Object[]) . This method is useful for implementing Object.hashCode() on objects containing multiple fields. For example, if an object that has three fields, x , y , and z , one could write:
@Override public int hashCode()
Warning: When a single object reference is supplied, the returned value does not equal the hash code of that object reference. This value can be computed by calling hashCode(Object) .
toString
toString
public static String toString(Object o, String nullDefault)
Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise.
compare
Returns 0 if the arguments are identical and c.compare(a, b) otherwise. Consequently, if both arguments are null 0 is returned. Note that if one of the arguments is null , a NullPointerException may or may not be thrown depending on what ordering policy, if any, the Comparator chooses to have for null values.
requireNonNull
public static T requireNonNull(T obj)
Checks that the specified object reference is not null . This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below:
requireNonNull
Checks that the specified object reference is not null and throws a customized NullPointerException if it is. This method is designed primarily for doing parameter validation in methods and constructors with multiple parameters, as demonstrated below:
Class Objects
This class consists of static utility methods for operating on objects, or checking certain conditions before operation. These utilities include null -safe or null -tolerant methods for computing the hash code of an object, returning a string for an object, comparing two objects, and checking if indexes or sub-range values are out of bounds.
Method Summary
Checks if the sub-range from fromIndex (inclusive) to fromIndex + size (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).
Checks if the sub-range from fromIndex (inclusive) to fromIndex + size (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).
Checks if the sub-range from fromIndex (inclusive) to toIndex (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).
Checks if the sub-range from fromIndex (inclusive) to toIndex (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.
Returns the first argument if it is non- null and otherwise returns the non- null value of supplier.get() .
Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise.
Methods declared in class java.lang.Object
Method Details
equals
Returns true if the arguments are equal to each other and false otherwise. Consequently, if both arguments are null , true is returned. Otherwise, if the first argument is not null , equality is determined by calling the equals method of the first argument with the second argument of this method. Otherwise, false is returned.
deepEquals
Returns true if the arguments are deeply equal to each other and false otherwise. Two null values are deeply equal. If both arguments are arrays, the algorithm in Arrays.deepEquals is used to determine equality. Otherwise, equality is determined by using the equals method of the first argument.
hashCode
hash
Generates a hash code for a sequence of input values. The hash code is generated as if all the input values were placed into an array, and that array were hashed by calling Arrays.hashCode(Object[]) . This method is useful for implementing Object.hashCode() on objects containing multiple fields. For example, if an object that has three fields, x , y , and z , one could write:
@Override public int hashCode()
Warning: When a single object reference is supplied, the returned value does not equal the hash code of that object reference. This value can be computed by calling hashCode(Object) .
toString
toString
Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise.
compare
Returns 0 if the arguments are identical and c.compare(a, b) otherwise. Consequently, if both arguments are null 0 is returned. Note that if one of the arguments is null , a NullPointerException may or may not be thrown depending on what ordering policy, if any, the Comparator chooses to have for null values.
requireNonNull
Checks that the specified object reference is not null . This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below:
requireNonNull
Checks that the specified object reference is not null and throws a customized NullPointerException if it is. This method is designed primarily for doing parameter validation in methods and constructors with multiple parameters, as demonstrated below:
public Foo(Bar bar, Baz baz)
isNull
nonNull
requireNonNullElse
requireNonNullElseGet
Returns the first argument if it is non- null and otherwise returns the non- null value of supplier.get() .
requireNonNull
Checks that the specified object reference is not null and throws a customized NullPointerException if it is. Unlike the method requireNonNull(Object, String) , this method allows creation of the message to be deferred until after the null check is made. While this may confer a performance advantage in the non-null case, when deciding to call this method care should be taken that the costs of creating the message supplier are less than the cost of just creating the string message directly.
checkIndex
Objects Class
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
This class consists of static utility methods for operating on objects, or checking certain conditions before operation.
[Android.Runtime.Register("java/util/Objects", DoNotGenerateAcw=true)] public sealed class Objects : Java.Lang.Object
[] type Objects = class inherit Object
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Properties
Returns the runtime class of this Object .
The handle to the underlying Android instance.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
Methods
Checks if the sub-range from fromIndex (inclusive) to fromIndex + size (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).
Checks if the sub-range from fromIndex (inclusive) to toIndex (exclusive) is within the bounds of range from 0 (inclusive) to length (exclusive).
Checks if the index is within the bounds of the range from 0 (inclusive) to length (exclusive).
Creates and returns a copy of this object.
Returns 0 if the arguments are identical and c.compare(a, b) otherwise.
Returns true if the arguments are deeply equal to each other and false otherwise.
Indicates whether some other object is «equal to» this one.
Returns true if the arguments are equal to each other and false otherwise.
Returns a hash code value for the object.
Generates a hash code for a sequence of input values.
Returns the hash code of a non- null argument and 0 for a null argument.
Returns true if the provided reference is null otherwise returns false .
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
Returns true if the provided reference is non- null otherwise returns false .
Wakes up a single thread that is waiting on this object’s monitor.
Wakes up all threads that are waiting on this object’s monitor.
Checks that the specified object reference is not null .
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.
Returns the first argument if it is non- null and otherwise returns the non- null second argument.
Returns the first argument if it is non- null and otherwise returns the non- null value of supplier.get() .
Returns a string representation of the object.
Returns the result of calling toString for a non- null argument and «null» for a null argument.
Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
Causes the current thread to wait until either another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or a specified amount of time has elapsed.
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
Performs an Android runtime-checked type conversion.