Class AllocUtil


  • public class AllocUtil
    extends java.lang.Object
    For ZK-2289, Memory allocation utility.
    Since:
    7.0.3
    Author:
    henrichen
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static AllocUtil inst  
    • Constructor Summary

      Constructors 
      Constructor Description
      AllocUtil()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <V> java.util.Set<V> addLinkedHashSet​(java.util.Set<V> set, V value)  
      <V> java.util.List<V> addList​(java.util.List<V> list, V value)
      Add value into the spcified list.
      <V> java.util.Set<V> addSet​(java.util.Set<V> set, V value)
      Add value into the specified set.
      <V> java.util.Set<V> addWeakIdentityHashSet​(java.util.Set<V> set, V value)  
      <K,​V>
      java.util.Map<K,​V>
      newLinkedHashMap​(int size)
      Prepare a suitable LinkedHashMap that optimize the space.
      java.lang.Object processScript​(java.lang.Object script)
      Returns the processed script.
      <K,​V>
      java.util.Map<K,​V>
      putLinkedHashMap​(java.util.Map<K,​V> map, K key, V value)
      Put key, value into the specified LinkedHashMap.
      <K,​V>
      java.util.Map<K,​V>
      putMap​(java.util.Map<K,​V> map, K key, V value)
      Put key, value into the specified map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AllocUtil

        public AllocUtil()
    • Method Detail

      • putMap

        public <K,​V> java.util.Map<K,​V> putMap​(java.util.Map<K,​V> map,
                                                           K key,
                                                           V value)
        Put key, value into the specified map.
        Parameters:
        map - the map to be put key, value in.
        key - the key
        value - the value
        Returns:
        the map
      • putLinkedHashMap

        public <K,​V> java.util.Map<K,​V> putLinkedHashMap​(java.util.Map<K,​V> map,
                                                                     K key,
                                                                     V value)
        Put key, value into the specified LinkedHashMap.
        Parameters:
        map - the LinkedHashMap to be put key, value in.
        key - the key
        value - the value
        Returns:
        the map
      • newLinkedHashMap

        public <K,​V> java.util.Map<K,​V> newLinkedHashMap​(int size)
        Prepare a suitable LinkedHashMap that optimize the space.
      • addSet

        public <V> java.util.Set<V> addSet​(java.util.Set<V> set,
                                           V value)
        Add value into the specified set.
        Parameters:
        set - the set to be add value in
        value - the value
        Returns:
        the set
      • addLinkedHashSet

        public <V> java.util.Set<V> addLinkedHashSet​(java.util.Set<V> set,
                                                     V value)
      • addWeakIdentityHashSet

        public <V> java.util.Set<V> addWeakIdentityHashSet​(java.util.Set<V> set,
                                                           V value)
      • addList

        public <V> java.util.List<V> addList​(java.util.List<V> list,
                                             V value)
        Add value into the spcified list.
        Parameters:
        list - the list to be add value in
        value - the value
        Returns:
        the list
      • processScript

        public java.lang.Object processScript​(java.lang.Object script)
        Returns the processed script.
        Parameters:
        script -