mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 10:27:17 +01:00
48 lines
1.3 KiB
Java
48 lines
1.3 KiB
Java
package com.google.common.base;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.J2ktIncompatible;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@J2ktIncompatible
|
|
@GwtIncompatible
|
|
/* loaded from: classes8.dex */
|
|
public final class Defaults {
|
|
private static final Double DOUBLE_DEFAULT = Double.valueOf(0.0d);
|
|
private static final Float FLOAT_DEFAULT = Float.valueOf(0.0f);
|
|
|
|
private Defaults() {
|
|
}
|
|
|
|
public static <T> T defaultValue(Class<T> cls) {
|
|
Preconditions.checkNotNull(cls);
|
|
if (!cls.isPrimitive()) {
|
|
return null;
|
|
}
|
|
if (cls == Boolean.TYPE) {
|
|
return (T) Boolean.FALSE;
|
|
}
|
|
if (cls == Character.TYPE) {
|
|
return (T) (char) 0;
|
|
}
|
|
if (cls == Byte.TYPE) {
|
|
return (T) (byte) 0;
|
|
}
|
|
if (cls == Short.TYPE) {
|
|
return (T) (short) 0;
|
|
}
|
|
if (cls == Integer.TYPE) {
|
|
return (T) 0;
|
|
}
|
|
if (cls == Long.TYPE) {
|
|
return (T) 0L;
|
|
}
|
|
if (cls == Float.TYPE) {
|
|
return (T) FLOAT_DEFAULT;
|
|
}
|
|
if (cls == Double.TYPE) {
|
|
return (T) DOUBLE_DEFAULT;
|
|
}
|
|
return null;
|
|
}
|
|
}
|