class PrimitiveLongCollections {

    public static long[] deduplicate( long[] values )
    {
        if ( values.length < 2 )
        {
            return values;
        }
        long lastValue = values[0];
        int uniqueIndex = 1;
        for ( int i = 1; i < values.length; i++ )
        {
            long currentValue = values[i];
            if ( currentValue != lastValue )
            {
                values[uniqueIndex] = currentValue;
                lastValue = currentValue;
                uniqueIndex++;
            }
        }
        return uniqueIndex < values.length ? Arrays.copyOf( values, uniqueIndex ) : values;
    }

    private  PrimitiveLongCollections();

}