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

org.hisp.dhis.util.IdentifiableObjectUtils Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package org.hisp.dhis.util;

import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import org.hisp.dhis.model.IdentifiableObject;

@NoArgsConstructor( access = AccessLevel.PRIVATE )
public class IdentifiableObjectUtils
{
    /**
     * Returns a list of object identifiers.
     *
     * @param objects the list of {@link IdentifiableObject}.
     * @return a list of object identifiers.
     */
    public  List getIds( Collection objects )
    {
        return objects.stream()
            .filter( Objects::nonNull )
            .map( IdentifiableObject::getId )
            .collect( Collectors.toList() );
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy