Kizspy Question: 42
(Choose 1 answer)
In a logistics application, you need to associate each product with its corresponding warehouse location.
Illustrate how you would use a Java collection to model this relationship, considering the principles of
association and key-value mapping.
A. Use a HashMap<Product, WarehouseLocation> for direct key-value mapping.
B. Implement a custom ProductWarehouseAssociation class with parallel arrays.
C. Utilize a LinkedHashMap<Product, WarehouseLocation> to maintain insertion order.
D. Design a TreeMap<Product, WarehouseLocation> for sorted key-value mapping.
E. Choose a HashSet<ProductWarehousePair> for efficient storage of associations.
F. Implement a custom graph structure to represent the relationships between products and locations.