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

com.cognite.client.util.Items Maven / Gradle / Ivy

There is a newer version: 2.3.3
Show newest version
package com.cognite.client.util;

import com.cognite.client.dto.Item;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Utility class for helping build {@link Item} objects.
 */
public class Items {

    /**
     * Build a list of {@link Item} based on a set of {@code externaIds}.
     *
     * @param externalId The {@code externaIds} to use as a basis for the {@code Items}.
     * @return The corresponding list of {@link Item}
     */
    public static List parseItems(String... externalId) {
        return Arrays.stream(externalId)
                .map(extId -> Item.newBuilder().setExternalId(extId).build())
                .collect(Collectors.toList());
    }

    /**
     * Build a list of {@link Item} based on a set of {@code ids}.
     *
     * @param internalId The {@code ids} to use as a basis for the {@code Items}.
     * @return The corresponding list of {@link Item}
     */
    public static List parseItems(long... internalId) {
        return Arrays.stream(internalId)
                .mapToObj(id -> Item.newBuilder().setId(id).build())
                .collect(Collectors.toList());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy