Class Collections

java.lang.Object
org.javalite.common.Collections

public final class Collections extends Object
Author:
Igor Polevoy, Eric Nielsen
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T[]
    arr​(T... values)
    Create array from values.
    static <T> T[]
    array​(T... values)
    Create array from values.
    static <T> List<T>
    li​(T... values)
    Create a list from values.
    static <T> List<T>
    list​(T... values)
    Create a list from values.
    static <K,​ V> Map<K,​V>
    map​(Object... keysAndValues)
    Create a map from keys and values.
    static <T> Set<T>
    set​(T... values)
    Creates a set from values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • arr

      public static <T> T[] arr(T... values)
      Create array from values.
      Parameters:
      values - values to create array from.
      Returns:
      array filled with values from arguments.
    • array

      public static <T> T[] array(T... values)
      Create array from values.
      Parameters:
      values - values to create array from.
      Returns:
      array filled with values from arguments.
    • set

      public static <T> Set<T> set(T... values)
      Creates a set from values.
      Parameters:
      values - values for a set.
      Returns:
      set filled with values.
    • map

      public static <K,​ V> Map<K,​V> map(Object... keysAndValues)
      Create a map from keys and values.
      Parameters:
      keysAndValues - list of key value pairs. The number of items must be even. The argument at index 0 is a key of the value at index 1, argument at index 2 is key of value at index 3, and so on.
      Returns:
      Map filled with keys and values.
    • li

      public static <T> List<T> li(T... values)
      Create a list from values.
      Parameters:
      values - values to create a list from.
      Returns:
      list with values.
    • list

      public static <T> List<T> list(T... values)
      Create a list from values.
      Parameters:
      values - values to create a list from.
      Returns:
      list with values.