public final class Util extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static void | assertBackgroundThread()Throws an  IllegalArgumentExceptionif called on the main thread. | 
| static void | assertMainThread()Throws an  IllegalArgumentExceptionif called on a thread other than the main
 thread. | 
| static boolean | bothNullOrEqual(Object a,
               Object b)Null-safe equivalent of  a.equals(b). | 
| static <T> Queue<T> | createQueue(int size)Creates a  Queueof the given size using Glide's preferred implementation. | 
| static int | getBitmapByteSize(Bitmap bitmap)Returns the in memory size of the given  Bitmapin bytes. | 
| static int | getBitmapByteSize(int width,
                 int height,
                 Bitmap.Config config)Returns the in memory size of  Bitmapwith the given width, height, andBitmap.Config. | 
| static int | getSize(Bitmap bitmap)Deprecated. 
 Use  getBitmapByteSize(android.graphics.Bitmap)instead. Scheduled to be
 removed in Glide 4.0. | 
| static <T> List<T> | getSnapshot(Collection<T> other)Returns a copy of the given list that is safe to iterate over and perform actions that may
 modify the original list. | 
| static int | hashCode(boolean value) | 
| static int | hashCode(boolean value,
        int accumulator) | 
| static int | hashCode(float value) | 
| static int | hashCode(float value,
        int accumulator) | 
| static int | hashCode(int value) | 
| static int | hashCode(int value,
        int accumulator) | 
| static int | hashCode(Object object,
        int accumulator) | 
| static boolean | isOnBackgroundThread()Returns  trueif called on a background thread,falseotherwise. | 
| static boolean | isOnMainThread()Returns  trueif called on the main thread,falseotherwise. | 
| static boolean | isValidDimensions(int width,
                 int height)Returns true if width and height are both > 0 and/or equal to  Target.SIZE_ORIGINAL. | 
| static String | sha256BytesToHex(byte[] bytes)Returns the hex string of the given byte array representing a SHA256 hash. | 
public static String sha256BytesToHex(byte[] bytes)
@Deprecated public static int getSize(Bitmap bitmap)
getBitmapByteSize(android.graphics.Bitmap) instead. Scheduled to be
 removed in Glide 4.0.public static int getBitmapByteSize(Bitmap bitmap)
Bitmap in bytes.public static int getBitmapByteSize(int width,
                                    int height,
                                    Bitmap.Config config)
Bitmap with the given width, height, and
 Bitmap.Config.public static boolean isValidDimensions(int width,
                                        int height)
Target.SIZE_ORIGINAL.public static void assertMainThread()
IllegalArgumentException if called on a thread other than the main
 thread.public static void assertBackgroundThread()
IllegalArgumentException if called on the main thread.public static boolean isOnMainThread()
true if called on the main thread, false otherwise.public static boolean isOnBackgroundThread()
true if called on a background thread, false otherwise.public static <T> Queue<T> createQueue(int size)
Queue of the given size using Glide's preferred implementation.public static <T> List<T> getSnapshot(Collection<T> other)
See #303 and #375.
public static boolean bothNullOrEqual(Object a, Object b)
a.equals(b).public static int hashCode(int value)
public static int hashCode(int value,
                           int accumulator)
public static int hashCode(float value)
public static int hashCode(float value,
                           int accumulator)
public static int hashCode(Object object, int accumulator)
public static int hashCode(boolean value,
                           int accumulator)
public static int hashCode(boolean value)