Documentation of 'com.datumbox.framework.common.dataobjects.AssociativeArray' Java class
AssociativeArray
com.datumbox.framework.common.dataobjects

Class AssociativeArray

  • All Implemented Interfaces:
    java.io.Serializable


    public class AssociativeArray
    extends AbstractDataStructureMap<java.util.Map<java.lang.Object,java.lang.Object>>
    Data structure which stores internally a Map. The class provides a number of methods to access and modify the internal map.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      AssociativeArray()
      Default constructor which initializes the internal data with a LinkedHashMap.
      AssociativeArray(java.util.Map<java.lang.Object,java.lang.Object> internalData)
      Constructor that initializes the internal data with the provided map.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addValues(AssociativeArray array)
      Adds the provided associative array to the current object.
      static AssociativeArray convert2Unmodifiable(AssociativeArray original)
      Converts the internal data of the provided AssociativeArray to unmondifiable but it does not copy its values.
      AssociativeArray copy()
      static AssociativeArray copy2Unmodifiable(AssociativeArray original)
      Copies the provided AssociativeArray and builds a new which is unmodifiable.
      java.util.Set<java.util.Map.Entry<java.lang.Object,java.lang.Object>> entrySet()
      Returns the entrySet of the internal map.
      boolean equals(java.lang.Object o)
      java.lang.Object get(java.lang.Object key)
      Returns the value which is associated with the provided key.
      java.lang.Double getDouble(java.lang.Object key)
      Gets value of the particular key from the map and converts it into a Double.
      int hashCode()
      java.util.Set<java.lang.Object> keySet()
      Returns the keySet of the internal map.
      void multiplyValues(double multiplier)
      Multiplies the values of the object with a particular multiplier.
      void overwrite(java.util.Map<java.lang.Object,java.lang.Object> data)
      Overwrites the contents of the internal data of this object with the ones of the provided map.
      java.lang.Object put(java.lang.Object key, java.lang.Object value)
      Adds a particular key-value into the internal map.
      void putAll(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> m)
      Adds all the key-value combinations of the provided map in the internal map.
      java.lang.Object remove(java.lang.Object key)
      Removes a particular key from the internal map and returns the value associated with that key if present in the map.
      void subtractValues(AssociativeArray array)
      Subtracts the provided associative array to the current object.
      FlatDataCollection toFlatDataCollection()
      Returns a FlatDataCollection with the values of the internal map.
      FlatDataList toFlatDataList()
      Returns a FlatDataList with the values of the internal map.
      java.lang.String toString()
      java.util.Collection<java.lang.Object> values()
      Returns the values of the internal map.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AssociativeArray

        public AssociativeArray()
        Default constructor which initializes the internal data with a LinkedHashMap.
      • AssociativeArray

        public AssociativeArray(java.util.Map<java.lang.Object,java.lang.Object> internalData)
        Constructor that initializes the internal data with the provided map.
        Parameters:
        internalData -
    • Method Detail

      • copy2Unmodifiable

        public static AssociativeArray copy2Unmodifiable(AssociativeArray original)
        Copies the provided AssociativeArray and builds a new which is unmodifiable.
        Parameters:
        original -
        Returns:
      • convert2Unmodifiable

        public static AssociativeArray convert2Unmodifiable(AssociativeArray original)
        Converts the internal data of the provided AssociativeArray to unmondifiable but it does not copy its values. This means that if the original AssociativeArray gets modified, the data of the new object will be modified too. This method is not as safe as copy2Unmodifiable() but it should be preferred when speed is crucial.
        Parameters:
        original -
        Returns:
      • overwrite

        public final void overwrite(java.util.Map<java.lang.Object,java.lang.Object> data)
        Overwrites the contents of the internal data of this object with the ones of the provided map.
        Parameters:
        data -
      • addValues

        public final void addValues(AssociativeArray array)
        Adds the provided associative array to the current object. All the columns of this object should be numeric or boolean or else an exception is thrown.
        Parameters:
        array -
      • subtractValues

        public final void subtractValues(AssociativeArray array)
        Subtracts the provided associative array to the current object. All the columns of this object should be numeric or boolean or else an exception is thrown.
        Parameters:
        array -
      • multiplyValues

        public final void multiplyValues(double multiplier)
        Multiplies the values of the object with a particular multiplier. All the columns of this object should be numeric or boolean or else an exception is thrown.
        Parameters:
        multiplier -
      • remove

        public final java.lang.Object remove(java.lang.Object key)
        Removes a particular key from the internal map and returns the value associated with that key if present in the map.
        Parameters:
        key -
        Returns:
      • get

        public final java.lang.Object get(java.lang.Object key)
        Returns the value which is associated with the provided key.
        Parameters:
        key -
        Returns:
      • getDouble

        public final java.lang.Double getDouble(java.lang.Object key)
        Gets value of the particular key from the map and converts it into a Double. If not found null is returned. The value must be numeric or boolean or else an exception is thrown.
        Parameters:
        key -
        Returns:
      • put

        public final java.lang.Object put(java.lang.Object key,
                                          java.lang.Object value)
        Adds a particular key-value into the internal map. It returns the previous value which was associated with that key.
        Parameters:
        key -
        value -
        Returns:
      • putAll

        public void putAll(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> m)
        Adds all the key-value combinations of the provided map in the internal map.
        Parameters:
        m -
      • entrySet

        public final java.util.Set<java.util.Map.Entry<java.lang.Object,java.lang.Object>> entrySet()
        Returns the entrySet of the internal map.
        Returns:
      • keySet

        public final java.util.Set<java.lang.Object> keySet()
        Returns the keySet of the internal map.
        Returns:
      • values

        public final java.util.Collection<java.lang.Object> values()
        Returns the values of the internal map.
        Returns:
      • toFlatDataCollection

        public FlatDataCollection toFlatDataCollection()
        Returns a FlatDataCollection with the values of the internal map. The method does not copy the data.
        Returns:
      • toFlatDataList

        public FlatDataList toFlatDataList()
        Returns a FlatDataList with the values of the internal map. The method might require to copy the data.
        Returns:
      • equals

        public boolean equals(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.