From 5c255814efbbecb9af0be7d5478ebc32420da491 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Wed, 20 Apr 2022 20:17:26 +0300 Subject: [PATCH] fix: remove last usage of "List" --- L3/LD_24/Code/TaskUtils.cs | 8 ++++---- L3/LD_24/Forma1.aspx.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/L3/LD_24/Code/TaskUtils.cs b/L3/LD_24/Code/TaskUtils.cs index cd7c7e9..7504c62 100644 --- a/L3/LD_24/Code/TaskUtils.cs +++ b/L3/LD_24/Code/TaskUtils.cs @@ -16,7 +16,7 @@ namespace LD_24.Code /// /// List of orders /// List of products ids - public static List FindMostPopularProducts(IEnumerable orders) + public static LinkedList FindMostPopularProducts(IEnumerable orders) { Dictionary productSales = new Dictionary(); foreach (Order order in orders) @@ -31,7 +31,7 @@ namespace LD_24.Code } } - List mostPopularProducts = new List(); + LinkedList mostPopularProducts = new LinkedList(); int mostPopularCount = 0; foreach (string product in productSales.Keys) { @@ -39,7 +39,7 @@ namespace LD_24.Code if (count > mostPopularCount) { mostPopularCount = count; - mostPopularProducts = new List { product }; + mostPopularProducts = new LinkedList { product }; } else if (count == mostPopularCount) { mostPopularProducts.Add(product); @@ -120,7 +120,7 @@ namespace LD_24.Code /// List of products /// List of product ids /// List of products - public static LinkedList FindByID(IEnumerable products, List ids) + public static LinkedList FindByID(IEnumerable products, LinkedList ids) { LinkedList foundProducts = new LinkedList(); foreach (string id in ids) diff --git a/L3/LD_24/Forma1.aspx.cs b/L3/LD_24/Forma1.aspx.cs index 398d400..40fdb1f 100644 --- a/L3/LD_24/Forma1.aspx.cs +++ b/L3/LD_24/Forma1.aspx.cs @@ -42,7 +42,7 @@ namespace LD_24 var products = InOutUtils.ReadProducts(FileUpload1.FileContent); var orders = InOutUtils.ReadOrders(FileUpload2.FileContent); - List mostPopularProductIds = TaskUtils.FindMostPopularProducts(orders); + var mostPopularProductIds = TaskUtils.FindMostPopularProducts(orders); var mostPopularProducts = TaskUtils.FindByID(products, mostPopularProductIds); var filteredProducts = TaskUtils.FilterByQuantitySoldAndPrice(products, orders, n, k); var customersWithSingleProduct = TaskUtils.FindCustomerWithSingleProduct(orders);