All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.mobile.logic.operators.array.DistinctOperation.kt Maven / Gradle / Ivy

package pl.allegro.mobile.logic.operators.array

import pl.allegro.mobile.logic.ClientLogicArray
import pl.allegro.mobile.logic.ClientLogicElement
import pl.allegro.mobile.logic.ClientLogicMarker
import pl.allegro.mobile.logic.ClientLogicOperator
import pl.allegro.mobile.logic.operators.OperatorFactory

internal interface DistinctOperation {
    /**
     * Distinct elements from the given array.
     * @receiver list of client side elements (use buildListOfElements or listOfElements) or client side operation that returns array
     * @return distinct operator evaluated client side.
     * Returns a list containing only distinct elements from the given list.
     * @see: DistinctOperationTest
     */
    @ClientLogicMarker
    fun  ClientLogicArray.distinct() = DistinctOperatorFactory().create(this)
}

private class DistinctOperatorFactory : ArrayOperatorFactory("distinct") {
    fun create(vararg elements: ClientLogicElement) = ClientLogicOperator(name, *elements)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy