Class Immutables

java.lang.Object
org.infinispan.commons.util.Immutables

public class Immutables extends Object
Factory for generating immutable type wrappers.
Since:
4.0
Author:
Jason T. Greene, Galder ZamarreƱo, Tristan Tarrant
  • Constructor Details

    • Immutables

      public Immutables()
  • Method Details

    • immutableListConvert

      public static <T> List<T> immutableListConvert(Collection<? extends T> source)
      Converts a Collection to an immutable List by copying it.
      Parameters:
      source - the collection to convert
      Returns:
      a copied/converted immutable list
    • immutableTypedProperties

      public static TypedProperties immutableTypedProperties(TypedProperties properties)
      Creates an immutable copy of the properties.
      Parameters:
      properties - the TypedProperties to copy
      Returns:
      the immutable copy
    • immutableListWrap

      public static <T> List<T> immutableListWrap(T... array)
      Wraps an array with an immutable list. There is no copying involved.
      Parameters:
      array - the array to wrap
      Returns:
      a list containing the array
    • immutableListAdd

      public static <T> ImmutableListCopy<T> immutableListAdd(List<T> list, int position, T element)
    • immutableListReplace

      public static <T> ImmutableListCopy<T> immutableListReplace(List<T> list, int position, T element)
    • immutableListRemove

      public static <T> List<T> immutableListRemove(List<T> list, int position)
    • immutableSetWrap

      public static <T> Set<T> immutableSetWrap(Set<? extends T> set)
      Wraps a set with an immutable set. There is no copying involved.
      Parameters:
      set - the set to wrap
      Returns:
      an immutable set wrapper that delegates to the original set
    • immutableMapWrap

      public static <K, V> Map<K,V> immutableMapWrap(Map<? extends K,? extends V> map)
      Wraps a map with an immutable map. There is no copying involved.
      Parameters:
      map - the map to wrap
      Returns:
      an immutable map wrapper that delegates to the original map