Documentation API of the 'cern.colt.list.DistinctNumberList' Java class

Class DistinctNumberList

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class DistinctNumberListextends AbstractLongList
    Resizable compressed list holding numbers; based on the fact that a number from a large list with few distinct values need not take more than log(distinctValues) bits; implemented with a MinMaxNumberList. First see the package summary and javadoc tree view to get the broad picture.

    This class can, for example, be useful when making large lists of numbers persistent. Also useful when very large lists would otherwise consume too much main memory.

    You can add, get and set elements quite similar to java.util.ArrayList.

    Applicability: Applicable if data is highly skewed and legal values are known in advance. Robust in the presence of "outliers".

    Performance: Operations get(), size() and clear() are O(1), i.e. run in constant time. Operations like add() and set() are O(log(distinctValues.length)).

    Upon instantiation a contract is signed that defines the distinct values allowed to be hold in this list. It is not legal to store elements other than specified by the contract. Any attempt to violate the contract will throw an IllegalArgumentException.

    Although access methods are only defined on long values you can also store all other primitive data types: boolean, byte, short, int, long, float, double and char. You can do this by explicitly representing them as long values. Use casts for discrete data types. Use the methods of java.lang.Float and java.lang.Double for floating point data types: Recall that with those methods you can convert any floating point value to a long value and back without losing any precision:

    Example usage:

     DistinctNumberList list = ... instantiation goes here double d1 = 1.234; list.add(Double.doubleToLongBits(d1)); double d2 = Double.longBitsToDouble(list.get(0)); if (d1!=d2) System.out.println("This is impossible!"); DistinctNumberList list2 = ... instantiation goes here float f1 = 1.234f; list2.add((long) Float.floatToIntBits(f1)); float f2 = Float.intBitsToFloat((int)list2.get(0)); if (f1!=f2) System.out.println("This is impossible!"); 
    See Also:
    LongArrayList, MinMaxNumberList, Float, Double, Serialized Form

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.