Package jetbrains.buildServer.util
Class Objects
- java.lang.Object
-
- jetbrains.buildServer.util.Objects
-
public class Objects extends Object
Useful functions for working with different objects.- Since:
- 8.1
- Author:
- Leonid Bushuev from JetBrains
-
-
Constructor Summary
Constructors Constructor Description Objects()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Comparable<? super T>>
intcompare(T object1, T object2)Compares two comparable objects.static <T> TifNull(T value, T defaultValue)Returns the given value if it is not null, or the default value otherwise.
-
-
-
Method Detail
-
compare
public static <T extends Comparable<? super T>> int compare(@Nullable T object1, @Nullable T object2)
Compares two comparable objects. Null is treated as less than a not null object.- Type Parameters:
T- type of objects.- Parameters:
object1- the first object to compare.object2- the second object to compare.- Returns:
- the comparison result.
-
ifNull
@NotNull public static <T> T ifNull(@Nullable T value, @NotNull T defaultValue)Returns the given value if it is not null, or the default value otherwise.- Type Parameters:
T- type of value.- Parameters:
value- value to check and return if it is not null.defaultValue- default value - to return if the value is null.- Returns:
- non-null value.
-
-