Top Description Fields Constructors Methods
com.google.common.collect

pack-priv final Class Platform

extends Object
Class Inheritance
Annotations
@GwtCompatible
emulated:true
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, .J2ktIncompatible, java.util.Arrays, .Map, .Set, java.util.concurrent.ConcurrentHashMap, org.checkerframework.checker.nullness.qual.Nullable

Methods factored out so that they can be emulated differently in GWT.
Author
Hayward Chan

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static <T extends @Nullable Object> T[]
copy(Object[] source, int from, int to, T[] arrayOfType)

Equivalent to Arrays.copyOfRange(source, from, to, arrayOfType.getClass()).

pack-priv static <E extends Enum<E>> Class<E>
pack-priv static <T extends @Nullable Object> T[]
newArray(T[]
any array of the desired type
reference
,
int
the length of the new array
length
)

Returns a new array of the given length with the same type as a reference array.

pack-priv static <E> Set<E>
newConcurrentHashSet()

Returns the platform preferred implementation of a thread-safe hash set.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V>
newHashMapWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of a map based on a hash table.

pack-priv static <E extends @Nullable Object> Set<E>
newHashSetWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of a set based on a hash table.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V>
newLinkedHashMapWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of an insertion ordered map based on a hash table.

pack-priv static <E extends @Nullable Object> Set<E>
newLinkedHashSetWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of an insertion ordered set based on a hash table.

pack-priv static <E extends @Nullable Object> Set<E>
preservesInsertionOrderOnAddsSet()

Returns the platform preferred set implementation that preserves insertion order when used only for insertions.

pack-priv static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V>
preservesInsertionOrderOnPutsMap()

Returns the platform preferred map implementation that preserves insertion order when used only for insertions.

pack-priv static int
reduceExponentIfGwt(int exponent)

pack-priv static int
reduceIterationsIfGwt(int iterations)

pack-priv static MapMaker
tryWeakKeys(MapMaker mapMaker)

Configures the given map maker to use weak keys, if possible; does nothing otherwise (i.e., in GWT).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final Logger logger

Constructor Detail

Platformback to summary
private Platform()

Method Detail

copyback to summary
pack-priv static <T extends @Nullable Object> T[] copy(Object[] source, int from, int to, T[] arrayOfType)

Equivalent to Arrays.copyOfRange(source, from, to, arrayOfType.getClass()).

Annotations
@SuppressWarnings:nullness
getDeclaringClassOrObjectForJ2clback to summary
pack-priv static <E extends Enum<E>> Class<E> getDeclaringClassOrObjectForJ2cl(E e)
newArrayback to summary
pack-priv static <T extends @Nullable Object> T[] newArray(T[] reference, int length)

Returns a new array of the given length with the same type as a reference array.

Parameters
reference:T[]

any array of the desired type

length:int

the length of the new array

newConcurrentHashSetback to summary
pack-priv static <E> Set<E> newConcurrentHashSet()

Returns the platform preferred implementation of a thread-safe hash set.

newHashMapWithExpectedSizeback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V> newHashMapWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of a map based on a hash table.

newHashSetWithExpectedSizeback to summary
pack-priv static <E extends @Nullable Object> Set<E> newHashSetWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of a set based on a hash table.

newLinkedHashMapWithExpectedSizeback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V> newLinkedHashMapWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of an insertion ordered map based on a hash table.

newLinkedHashSetWithExpectedSizeback to summary
pack-priv static <E extends @Nullable Object> Set<E> newLinkedHashSetWithExpectedSize(int expectedSize)

Returns the platform preferred implementation of an insertion ordered set based on a hash table.

preservesInsertionOrderOnAddsSetback to summary
pack-priv static <E extends @Nullable Object> Set<E> preservesInsertionOrderOnAddsSet()

Returns the platform preferred set implementation that preserves insertion order when used only for insertions.

preservesInsertionOrderOnPutsMapback to summary
pack-priv static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V> preservesInsertionOrderOnPutsMap()

Returns the platform preferred map implementation that preserves insertion order when used only for insertions.

reduceExponentIfGwtback to summary
pack-priv static int reduceExponentIfGwt(int exponent)
reduceIterationsIfGwtback to summary
pack-priv static int reduceIterationsIfGwt(int iterations)
tryWeakKeysback to summary
pack-priv static MapMaker tryWeakKeys(MapMaker mapMaker)

Configures the given map maker to use weak keys, if possible; does nothing otherwise (i.e., in GWT). This is sometimes acceptable, when only server-side code could generate enough volume that reclamation becomes important.

Annotations
@J2ktIncompatible