java.lang.Object
ushiosan.jvm_utilities.lang.collection.CollectionsSync

public final class CollectionsSync extends Object
Class that has helper methods for data holders like Map, List, Set, Stack and Vector.

These collections are synchronized which means that they are safe to use in multiple processes.

  • Method Details

    • collectionOf

      @NotNull public static <T> @NotNull Collection<T> collectionOf(@NotNull @NotNull Collection<T> base)
      Create a mutable synchronized collection with all given elements.
      Type Parameters:
      T - collection generic type
      Parameters:
      base - the elements to insert
      Returns:
      a mutable synchronized collection with all elements
    • listOf

      @SafeVarargs @NotNull public static <T> @NotNull List<T> listOf(T @NotNull ... elements)
      Create a mutable synchronized list with all given elements.
      Type Parameters:
      T - list generic type
      Parameters:
      elements - the elements to insert
      Returns:
      a mutable synchronized list with all elements
    • setOf

      @SafeVarargs @NotNull public static <T> @NotNull Set<T> setOf(T @NotNull ... elements)
      Create a mutable synchronized set with all given elements.
      Type Parameters:
      T - list generic type
      Parameters:
      elements - the elements to insert
      Returns:
      a mutable synchronized set with all elements
    • mapOf

      @SafeVarargs @NotNull public static <K, V> @NotNull Map<K,V> mapOf(Map.Entry<K,V> @NotNull ... entries)
      Create a mutable synchronized map with all the given elements.
      Type Parameters:
      K - key entry type
      V - value entry type
      Parameters:
      entries - the elements to insert
      Returns:
      a mutable synchronized map with all content
    • mapOf

      @SafeVarargs @NotNull public static <K, V> @NotNull Map<K,V> mapOf(Pair<K,V> @NotNull ... pairs)
      Create a mutable synchronized map with all the given elements.
      Type Parameters:
      K - key entry type
      V - value entry type
      Parameters:
      pairs - the elements to insert
      Returns:
      a mutable synchronized map with all content