mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-13 10:31:03 +01:00
16 lines
357 B
Java
16 lines
357 B
Java
|
package nodomain.freeyourgadget.gadgetbridge.util;
|
||
|
|
||
|
public class JavaExtensions {
|
||
|
|
||
|
/**
|
||
|
* Equivalent c# '??' operator
|
||
|
* @param one first value
|
||
|
* @param two second value
|
||
|
* @return first if not null, or second if first is null
|
||
|
*/
|
||
|
public static <T> T coalesce(T one, T two)
|
||
|
{
|
||
|
return one != null ? one : two;
|
||
|
}
|
||
|
}
|