Class UStack

java.lang.Object
ushiosan.jvm.collections.UStack

public final class UStack extends Object
  • Method Details

    • make

      @SafeVarargs @NotNull public static <T> @NotNull Stack<T> make(T @NotNull ... elements)
      Create a stack with all given elements.
      Type Parameters:
      T - generic type list
      Parameters:
      elements - the elements to insert
      Returns:
      a linked list with all elements
    • makeDeque

      @SafeVarargs @NotNull public static <T> @NotNull Deque<T> makeDeque(T @NotNull ... elements)
      Create a deque with all given elements.
      Type Parameters:
      T - generic type list
      Parameters:
      elements - the elements to insert
      Returns:
      a linked list with all elements
    • makeLinkedDeque

      @SafeVarargs @NotNull public static <T> @NotNull Deque<T> makeLinkedDeque(T @NotNull ... elements)
      Create a deque with all given elements.
      Type Parameters:
      T - generic type list
      Parameters:
      elements - the elements to insert
      Returns:
      a linked list with all elements
    • makeConcurrentDeque

      @SafeVarargs @NotNull public static <T> @NotNull Deque<T> makeConcurrentDeque(T @NotNull ... elements)
      Create a deque with all given elements.
      Type Parameters:
      T - generic type list
      Parameters:
      elements - the elements to insert
      Returns:
      a linked list with all elements
    • transform

      @NotNull public static <T, R> @NotNull Stack<R> transform(@NotNull @NotNull Stack<T> original, @NotNull @NotNull Function<T,R> mapper)
      Converts a stack to another but with a different data type.
      Type Parameters:
      T - the original data type
      R - the target data type
      Parameters:
      original - the original stack that you want to convert
      mapper - function in charge of transforming each element of the stack
      Returns:
      the new stack with the converted data
    • transform

      @NotNull public static <T, R> @NotNull Deque<R> transform(@NotNull @NotNull Deque<T> original, @NotNull @NotNull Function<T,R> mapper)
      Converts one deque to another but with a different data type.
      Type Parameters:
      T - the original data type
      R - the target data type
      Parameters:
      original - the original deque that you want to convert
      mapper - function in charge of transforming each element of the deque
      Returns:
      the new deque with the converted data
    • isUnmodifiable

      public static boolean isUnmodifiable(@NotNull @NotNull Collection<?> collection)
      Check if the inspected collection supports the modification of its data
      Parameters:
      collection - the collection of data you want to inspect
      Returns:
      true if the collection is immutable or false otherwise
    • isUnmodifiable

      public static boolean isUnmodifiable(@NotNull @NotNull Map<?,?> map)
      Check if the inspected collection supports the modification of its data
      Parameters:
      map - the map of data you want to inspect
      Returns:
      true if the collection is immutable or false otherwise
    • combine

      @SafeVarargs @NotNull public static <T> @NotNull Collection<T> combine(boolean excludeDuplicates, List<T> @NotNull ... lts)
      Combine different lists into a single collection
      Type Parameters:
      T - generic collection type
      Parameters:
      excludeDuplicates - remove all duplicate items
      lts - the lists you want to merge
      Returns:
      returns a single collection with all the elements of the passed lists
    • combine

      @SafeVarargs @NotNull public static <T> @NotNull Collection<T> combine(List<T> @NotNull ... lts)
      Combine different lists into a single collection
      Type Parameters:
      T - generic collection type
      Parameters:
      lts - the lists you want to merge
      Returns:
      returns a single collection with all the elements of the passed lists