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

com.dft.api.shopify.model.ShopifyCustomers Maven / Gradle / Ivy

The newest version!
package com.dft.api.shopify.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ShopifyCustomers {

	private final Map customerIdToShopifyCustomer;

	public ShopifyCustomers(final List shopifyCustomers) {
		customerIdToShopifyCustomer = new HashMap<>(shopifyCustomers.size());
		shopifyCustomers.stream().forEach(shopifyCustomer -> {
			customerIdToShopifyCustomer.put(shopifyCustomer.getId(), shopifyCustomer);
		});
	}

	public ShopifyCustomer get(final String customerId) {
		return customerIdToShopifyCustomer.get(customerId);
	}

	public List values() {
		return new ArrayList<>(customerIdToShopifyCustomer.values());
	}

//	public List getAddresses() {
//		final Collection shopifyCustomers = customerIdToShopifyCustomer.values();
//		final List shopifyAddresses = new ArrayList<>(shopifyCustomers.size());
//		for (ShopifyCustomer shopifyCustomer : shopifyCustomers) {
//			shopifyAddresses.addAll(shopifyCustomer.getAddresses());
//		}
//		return shopifyAddresses;
//	}

	public int size() {
		return customerIdToShopifyCustomer.size();
	}

	public boolean containsKey(final String customerId) {
		return customerIdToShopifyCustomer.containsKey(customerId);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy