Class JsCollections


  • public class JsCollections
    extends Object
    Factory for JavaScript collection implementations with support for alternative JRE implementations.
    Since:
    1.0
    Author:
    Vaadin Ltd
    • Method Detail

      • array

        public static <T> JsArray<T> array()
        Creates a new JavaScript Array.
        Type Parameters:
        T - the array type
        Returns:
        a new JS array instance
      • array

        @SafeVarargs
        public static <T> JsArray<T> array​(T... values)
        Creates a new JavaScript Array with the given contents.
        Type Parameters:
        T - the array type
        Parameters:
        values - the values of the new array
        Returns:
        a new JS array instance
      • map

        public static <K,​V> JsMap<K,​V> map()
        Creates a new JavaScript Map.
        Type Parameters:
        K - the key type
        V - the value type
        Returns:
        a new JS map instance
      • weakMap

        public static <K,​V> JsWeakMap<K,​V> weakMap()
        Creates a new JavaScript WeakMap.
        Type Parameters:
        K - the key type
        V - the value type
        Returns:
        a new JS weak map instance
      • set

        public static <V> JsSet<V> set()
        Creates a new empty JavaScript Set.
        Type Parameters:
        V - the set type
        Returns:
        a new empty JS Set instance
      • set

        public static <T> JsSet<T> set​(JsSet<T> values)
        Creates a new JavaScript Set with the same contents as another set.
        Type Parameters:
        T - the set type
        Parameters:
        values - a set of values to add to the new set
        Returns:
        a new JS Set with the provided contents